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-23 : 07:40:55
|
| I have gone into the sql scheduler and have created a step where I need a file copied from one area to another.. DECLARE @SQL VARCHAR(120)--COPY A NEW ONE INSET @SQL = 'xp_cmdshell ' + CHAR(39) + 'COPY C:\Reports\Templates\TRIBUTE_DETAIL_IND.xls C:\Reports\TRIBUTE_DETAIL_IND.xls' + CHAR(39) EXEC (@SQL)Every time I run this I get the following error Executed as user: advocatemd\sqladmin. The process could not be created for step 7 of job 0x56FC8CF8E5D1084B99DCB56D98A901D5 (reason: The system cannot find the file specified). The step failed.the result of the sql command using PRINT SQL xp_cmdshell 'COPY C:\Reports\Templates\TRIBUTE_DETAIL_IND.xls C:\Reports\TRIBUTE_DETAIL_IND.xls'I have run the same sql statement on the same machine in a sql query and it works fine.. So what am I doing wrong.. |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2012-10-23 : 07:54:32
|
| One trail and error method is as follows:Remove that red marked part and then executeDECLARE @SQL VARCHAR(120)--COPY A NEW ONE INSET @SQL = 'xp_cmdshell ' + CHAR(39) + 'COPY C:\Reports\Templates\TRIBUTE_DETAIL_IND.xls C:\Reports\TRIBUTE_DETAIL_IND.xls' + CHAR(39)EXEC (@SQL)--Chandu |
 |
|
|
divan
Posting Yak Master
153 Posts |
Posted - 2012-10-23 : 08:07:24
|
| Still getting the same error.... |
 |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2012-10-23 : 09:29:47
|
One more suggestion is remove striked part.. DECLARE @SQL VARCHAR(120)--COPY A NEW ONE INSET @SQL = 'xp_cmdshell ' + CHAR(39) + 'COPY C:\Reports\Templates\TRIBUTE_DETAIL_IND.xls C:\Reports\TRIBUTE_DETAIL_IND.xls' + CHAR(39)EXEC (@SQL)It is working fine for me (I just put my file path)--Chandu |
 |
|
|
|
|
|