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
 Import/Export (DTS) and Replication (2000)
 Problems with BULK INSERT

Author  Topic 

rEd86
Starting Member

1 Post

Posted - 2004-11-02 : 15:36:21
Greetings.

I am trying to use BULK INSERT in a stored procedure to load data from text files into a SQL table and I'm having problems. My text file has a header row with field names. It would look something like this:

FirstName,LastName,Company,Telephone,birthdate
Bill,Gates,Microsoft,425-555-1212,10/28/1955
George,Bush,White House,202-555-1212,7/6/1946

Is there a way to use the header row to determine field order, instead of creating FORMATFILE?

Thanks!

nr
SQLTeam MVY

12543 Posts

Posted - 2004-11-02 : 16:35:46
Only by inserting into a staging table.
see
http://www.nigelrivett.net/MoveImportData.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -