Tuesday, March 20, 2012
Adding the Date to Filename of DTS Export
For Example:
Export092503.xls
I've tried various methods but nothing has worked as of yet.
Any ideas?
Thanks in Advance.
TechRickI export a standard file name, then rename using a BAT file. Here's the BAT file I use...
-------------------
@.echo off
c:
cd \SQL_Support_Applications\FTP Scripts\SONIC_Data
IF EXIST CUST_%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%.dat DEL CUST_%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%.dat
IF EXIST CUST_raw.dat REN CUST_raw.dat CUST_%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%.dat
EXIT
-------------------
It checks to see if the dated file exists and deletes before renaming.|||Hi TechRick!
If I get you correct, you run an data export task in a dts package.
In this case you can use an ActiveXTask in this package to get the system date and modify the properties of the export task. A similar example is shown here: http://www.sqldts.com/default.aspx?231
Hope this helps you!
Greetings,
Carstensql
Saturday, February 25, 2012
Adding images with SQL Server Express Management Studio
Can I add images to a table with SQL Server Express Management Studio? If so, how, if not, what alternative methods other than the point-and-click can I use?
Thanks in advance,
Fedor Steeman
hi Fedor,
there's no "point and click" solution for your requirement in SSMS... but you can "load" a column executing the appropriate Transact-SQL statement..
something like
SET NOCOUNT ON;USE tempdb;
GO
CREATE TABLE dbo.TestTB (
Id int NOT NULL PRIMARY KEY,
img varbinary(MAX) NULL
);
GO
PRINT 'retrieve the img from file';
DECLARE @.img varbinary(MAX);
SET @.img = (
SELECT Q.BulkColumn
FROM OPENROWSET(BULK 'D:\MVPLogo.gif', SINGLE_BLOB) AS Q
);
SELECT CONVERT(varchar(MAX),@.img);
PRINT 'then you can insert it into the desired table';
INSERT INTO dbo.TestTB VALUES ( 1 , @.img );
SELECT * FROM dbo.TestTB;
GO
DROP TABLE dbo.TestTB;
--<
retrieve the img from file
--
GIF89as ′ ? 4:u???jt£CJ?K{abridged}
then you can insert it into the desired table
Id img
--
1 GIF89as ′ ? 4:u???jt£CJ?K{abridged}
and that's it.. ![]()
regards