April 10, 2010 at 3:44 pm
I am currently trying to create a batch file which by looping through a list of files imports them into sql via a dts package using DTSRun Utility. I initially tested the batch by importing DTSRun utility in the batch file and it ran with no problems.
I then added for loop functionality into the batch file to help loop through the list of files and this is where I run into trouble.The syntax is as follows:
for /f "tokens=1,2,3" %%i in (C:\MyImport\Dirlist.txt)
DO
DTSRun /S "(local)" /N "MultipleFileImport" /G "{81FE4AE5-D2CC-47E6-B78C-9309CF4DDFB9}" /L "C:\Documents and Settings\eseosa\My Documents\dtslog.txt" /A "DatabaseName":"8"="ESSBASETESTDW" /A "FileName":"8"="C:\Documents and Settings\eseosa\My Documents\SQL_PRACTICE\%%i" /A "ServerName":"8"="(local)" /W "0" /E
The batch file now does not run. Any ideas on where I may be going wrong
April 14, 2010 at 3:55 am
I managed to solve this myself. The DO command had to be on the same line as the for /f "tokens = 1,2,3".....
Regards
Sauce1979
April 14, 2010 at 8:26 am
Funny, I was actually thinking of using SSIS and a For Each Loop to do this..
CEWII
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply