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 |
|
kiddoOnSQL
Starting Member
16 Posts |
Posted - 2011-10-25 : 00:21:06
|
| HelloI have multiple SQL jobs\agents that pick files from source folders, rename it, and then move it to a common destination folder.There are 5 source folders and 1 destination folder. Currently I have 5 sql jobs - each of these jobs polls an individual folder although all them (after renaming file in the source), move the file to a common destination.Now I want to be able to consolidate this to 1 sql job.While I can achieve this individually, multiple xcopy's dont seem to work in a sql job. I can make this work in a batch file but not in SQL.The first step in my SQL job is:Step 1:XCOPY \\workpc\data\G\Client1\*.XLS \\workpc\data\G\Client1\*.newExt1XCOPY \\workpc\data\G\Client2\*.XLS \\workpc\data\G\Client2\*.newExt2It renames files in the first folder (first line of Step1) but does not execute line 2 at all. Is there a reason why xcopy doesnt work as expected in SQL? |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2011-10-25 : 02:27:50
|
| You need to create a .bat-file or to run each line in a separate job step. I think the agent only accepts one-line commands.- LumbagoMy blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/ |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2011-10-25 : 02:30:41
|
| You should also look in to "robocopy" which is the best file copying utility out there, at least in my opinion. It's standard in Win7/2008 and a part of Win 2003 Feature Pack -> http://technet.microsoft.com/en-us/library/cc733145(WS.10).aspx- LumbagoMy blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/ |
 |
|
|
|
|
|