Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Importing data from CSV file to database

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-08-11 : 16:34:22
Sushil writes "I want to import data from a comma separated (CSV) file into my SQL server database. I tried both BULK INSERT and BCP utility and they both work. But now I want my database table to have one extra column than the number of columns in the CSV file. For example if the contents of the CSV file are as follows

1,2,3,4,5
a,b,c,d,e

I want the database table to have the following data

file1,1,2,3,4,5
file1,a,b,c,d,e

The whole idea is to store the file name that contained the data.

Is it possible using BCP or BULK INSERT to achieve this or is there another way it can be done?"
   

- Advertisement -