468,785 Members | 1,469 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,785 developers. It's quick & easy.

Trying to use a batch file to run a DTS program

Hello

I am trying to use a batch file to run a DTS program that I had created. Below is the Batch File code:


REM Type: Batch File
REM Created by: Raakish
REM Contact: raakish22@gmail.com
REM Import all excel files to SQL Server using DTS


REM Export DIR listing to E:\ArchiveTest\uploadtest\Dirlist.txt
dir E:\ArchiveTest\uploadtest\csv13995\*.csv /b > E:\ArchiveTest\uploadtest\Dirlist.txt


pause

REM Execute DTS package for every file name in the Dirlist.txt

for /f "tokens=1,2,3" %%i in (E:\ArchiveTest\uploadtest\Dirlist.txt)
do "C:\Program Files\Microsoft SQL Server\80\Tools\Bin\DTSrun.exe" -S"SQL"
-N"E:\ArchiveTest\uploadtest\MyImport2.dts"-A"ServerName"=
"local" -A"FileName"="E:\ArchiveTest\uploadtest\%%i" -A"DatabaseName"="ALUMNI"



pause

REM Rename all the files with "old" as suffix
ren E:\ArchiveTest\uploadtest\csv13995\*.csv *.csvold

The section that I am having trouble with is the for:

/f "tokens=1,2,3" %%i in (E:\ArchiveTest\uploadtest\Dirlist.txt)
do "C:\Program Files\Microsoft SQL Server\80\Tools\Bin\DTSrun.exe" -S"SQL"
-N"E:\ArchiveTest\uploadtest\MyImport2.dts"-A"ServerName"=
"local" -A"FileName"="E:\ArchiveTest\uploadtest\%%i" -A"DatabaseName"="ALUMNI"

Everything else seems to be working fine before that for loop is invoked..please help..
May 2 '07 #1
0 2377

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Roger Twomey | last post: by
5 posts views Thread by sjayaramit | last post: by
14 posts views Thread by =?Utf-8?B?R2lkaQ==?= | last post: by
reply views Thread by zhoujie | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.