Computing.Net > Forums > Programming > import files to SQL server

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

import files to SQL server

Reply to Message Icon

Name: layla
Date: July 8, 2004 at 03:32:07 Pacific
OS: pentium 3
CPU/Ram: 797M/256
Comment:

hello

i would like to import generated file from the Cisco router ACS " it generates a new file containing all the username...." at 12:01 AM, i created the DTS package, and the batch file:
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET DATE=%%B
REM Export DIR listing to D:\MyImport\Dirlist.txt
dir D:\MyImport\DATE.csv /b > D:\MyImport\Dirlist.txt


for /f "tokens=3 delims=," %%i in (D:\MyImport\Dirlist.txt)
do "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\DTSrun.exe" -F
"D:\myimport\MyImportDTS.dts" -Uimportuser -Pimport -A"ServerName"=
"SQL" -A"FileName"="D:\myimport\%%i" -A"DatabaseName"="Bank"

REM Rename all the files with "old" as suffix
ren D:\myimport\*.csv *.csvold

the error is " the syntax of the command is incorrect" for line " for/f tokens =3..."

do you have an idea what's the problem?
My best regards
Layla



Sponsored Link
Ads by Google

Response Number 1
Name: layla
Date: July 9, 2004 at 01:43:17 Pacific
Reply:

that's the update batch file....but still not working...it stops running on the "for /f "tokens=*" %%i in (D:\MyImport\Dirlist.txt)" and it gave me the message: the syntax of the command is incorrect"....the file Dirlist.txt contains the name of one file: ex 2004-07-09

REM Type: Batch File
REM Created by: layla
REM Import all csv files to SQL Server using DTS

FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET DATE=%%B
REM Export DIR listing to D:\MyImport\Dirlist.txt
dir D:\MyImport\%DATE%.csv /b > D:\MyImport\Dirlist.txt

for /f "tokens=*" %%i in (D:\MyImport\Dirlist.txt)
do "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\DTSrun.exe" -F
"D:\myimport\MyImportDTS.dts" -Uimportuser -Pimport -A"ServerName"=
"SQL" -A"FileName"="D:\MyImport\%%i" -A"DatabaseName"="layla"

REM Rename all the files with "old" as suffix
ren D:\myimport\*.csv *.csvold

thanks


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: import files to SQL server

VBScript to connect to SQL Server www.computing.net/answers/programming/vbscript-to-connect-to-sql-server/17134.html

connecting sql server from java www.computing.net/answers/programming/connecting-sql-server-from-java/11451.html

Need batch file to delete old files www.computing.net/answers/programming/need-batch-file-to-delete-old-files/14092.html