| Author |
Topic |
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2008-11-25 : 05:27:53
|
| every day i export data from DB to text file.all i need ,to change the name of text file as i explain before.and the job operate the dts.how i change the name |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2008-11-25 : 05:40:32
|
| you could use a bat file with dos commands to use this. |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2008-11-25 : 05:40:56
|
| If not a bat file, you could use dos commands with xp_cmdshell. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-25 : 05:49:14
|
| Add a variable to dts and map it to filename property using dynamic properties task. using it you can change the name by passing a value for variable. |
 |
|
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2008-11-25 : 05:49:22
|
| sorry,but my privious message jump.i wrote againhow i can change the name of the file, like "file200822512 115208"every day in the dts(tomorrow it'll look "file200822612 115208")in additioni wrote query that send mail, how i can write in @attachments ='D:\FILES\file1_' + GETDATE() + '052020.txt',the error is Line 14: Incorrect syntax near '+'.(i wrote GETDATE() ,cause i want to send every day so , the dts need to know to get to current file.) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-25 : 06:02:38
|
| where are you writing this exporession? |
 |
|
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2008-11-25 : 06:31:30
|
| i wrote in "EXECUTE SQL TASK" -in DTS.i didnt write akk the qurey.but is id go like that:exec Master.Dbo.xp_sendmail @recipients = 'inbs@xxx.co.il', @query = 'SELECT * FROM table1', @attachments ='D:\FILES\file1_' + GETDATE() + '052020.txt',, @subject = 'sent test file', @message = @msg, @attach_results = 'TRUE', @width = 450, @separator = '|'end |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-25 : 07:29:30
|
| http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=115136MadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-25 : 07:38:16
|
declare @filename nvarchaR(256)set @filename = 'D:\FILES\file1_' + GETDATE() + '052020.txt'exec Master.Dbo.xp_sendmail@recipients = 'inbs@xxx.co.il', @query = 'SELECT * FROM table1',@attachments = @filename,@subject = 'sent test file',@message = @msg,@attach_results = 'TRUE',@width = 450,@separator = '|'end You can't build strings when passing them as parameter values. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|