Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
cottage125
Starting Member
32 Posts |
Posted - 2008-11-26 : 15:18:51
|
I want to rename one template using SSIS's Execute SQL task or using sql server commandsI need to put timestamp while renameing the original file so u can say i wantC:\abc\test_temp.xls file to be renamed as C:\abc\test_112620081400.xls i can do that using batch file plz run first 3 lines as a batch file for /f "tokens=2-4* delims=/ " %%a in ('DATE /T') do set THEDATE=%%c%%b%%aRen C:\abc\test_temp.xls test_%THEDATE%.xlsPAUSE Then execute it works---------------------------- BUT IF U RUN IT IN SQL using xp_cmdshell IT GIVES ERRORrem DECLARE @rc intrem Exec master..xp_cmdshell'for /f "tokens=2-4* delims=/ " %%a in ('DATE /T') do set THEDATE=%%c%%b%%a'rem Exec master..xp_cmdshell'Ren C:\abc\test_temp.xls test_%THEDATE%.xls' Error=rem Msg 102, Level 15, State 1, Line 3rem Incorrect syntax near 'DATE'. so ultimately i want to rename a file using sql server.I want this as a part of one ssis packagewhich runs daily.Any other new,creative solution to rename is welcomed.Thanks |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-11-26 : 17:40:51
|
you can use Filesystem task in SSIS to do this. |
 |
|
|
|
|