I am trying to import multiple csv files into a database table.
I am using a dts package (to insert the date) and a batch file to list all the csv files.

This is the article I am following by Muthusamy Anantha Kumar (on this website).
http://www.databasejournal.com/featu...-Using-DTS.htm

Has anyone tried using this particular method?

I have managed to follow most of the article and steps, but unsure of step 2 - where the input file is added.
the input file asks for the name of a csv file - if i enter the name of a csv file, I can input this into a table ok.
However, I am confused by this this as the objective is to input multiple files.

In order to get something imported I have used the name of the first file to be imported (a.csv) in step 2, however this just results in only this solitary file being imported and no other.

(I am not using a sql query to create a new database and table, as I already have an existing db and table which I am using to input the data to.)


* My batch file works so far as creating a text file with a list of all csv files in same directory as the DTS package and csv files.
* My files do not get renamed to 'old' as the batch file below instructs.
* Not sure if I should specify this text file name (DirList.txt) as the name of the input file (in step 2) - but when I do, nothing is imported into the tables.


my batch file:
Code:
REM Export DIR listing to C:\MyImport\Dirlist.txt
dir c:\MyImport\*.csv /b > C:\MyImport\Dirlist.txt
 
REM Execute DTS package for every file name in the Dirlist.txt
 
for /f "tokens=1,2,3" %%i in (C:\MyImport\Dirlist.txt) 
	do "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\DTSrun.exe" -F
	"c:\myimport\myimportdts.dts" -Uimportuser -Pimport  -A"ServerName"=
	"TEST-SQL" -A"FileName"="c:\myimport\%%i" -A"DatabaseName"="myDBName"
 
REM Rename all the files with "old" as suffix
ren c:\myimport\*.csv *.csvold