Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import data from multiple csv files simultaneously??

Status
Not open for further replies.

MrPeds

Programmer
Jan 7, 2003
219
GB
Hi,

I have a number of .csv files all in the same format that I want to obtain data from and insert into a single table.

these files contain historical data whcih i want to insert into my fact table.

is there any quick way of looping through each file in turn (they are all in the same directory) and then inserting the data into the table?

I cant stand the thought of doing each one separately!

Thanks,

MrPeds.
 
Are they all the same file layout??? Same number of fields, delimited the same and such. IF SO ...

just run a DOS Command to copy all the into one big file as in ...

COPY *.txt to ALL.txt

and then import.

Thanks

J. Kusch
 
If you need to do this in your dts package, create and Execute SQL task and enter the code of ...
Code:
EXEC master..xp_cmdshell 'COPY C:\MyDir\*.txt C:\MyDir\All.txt'


Thanks

J. Kusch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top