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 |
|
divan
Posting Yak Master
153 Posts |
Posted - 2012-10-19 : 14:44:39
|
| I have a step in my scheduler that is as followsDECLARE @SQL VARCHAR(120)--COPY A NEW ONE IN SET @SQL = 'xp_cmdshell ' + CHAR(39) + 'COPY C:\Reports\Templates\TRIBUTE_DETAIL_IND.xls C:\Reports\TRIBUTE_DETAIL_IND.xls' + CHAR(39) EXEC (@SQL)I have the file that is looking for in the folder that I have assigned it to look into:TRIBUTE_DETAIL_IND.xlsbut this step fails and the error is MessageExecuted as user: The process could not be created for step 7 of job 0x56FC8CF8E5D1084B99DCB56D98A901D5 (reason: The system cannot find the file specified). The step failed. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
mandm
Posting Yak Master
120 Posts |
Posted - 2012-10-19 : 15:15:43
|
| Try thisSET @SQL = 'xp_cmdshell ' + CHAR(39) + 'COPY C:\Reports\Templates\TRIBUTE_DETAIL_IND.xls' + CHAR(39) + ' ' + CHAR(39) + 'C:\Reports\TRIBUTE_DETAIL_IND.xls' + CHAR(39)EXEC (@SQL) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-10-19 : 22:29:04
|
| if its in client machine you might have to specify unc path instead------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
divan
Posting Yak Master
153 Posts |
Posted - 2012-10-22 : 13:58:42
|
| I went on the same machine and went into sql and ran the script and the file was copied.. the result of the PRINT @SQL IS xp_cmdshell 'COPY C:\Reports\Templates\TRIBUTE_DETAIL_IND.xls C:\Reports\TRIBUTE_DETAIL_IND.xls' |
 |
|
|
|
|
|