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.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-07-12 : 07:11:39
|
Mike writes "I have a need for a procedure that imports text files into sql server 2000. The file format is not fixed, it may have different columns, the file will always be comma delimited.I would like to write one procedure that can import any text file into a new table in the database.Any ideas on how to do this? DTS possibly?Thanks for the help.-Mike" |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-12 : 07:23:14
|
Bulk Insert will do this job but the number of columns and datatypes should match with the tableMadhivananFailing to plan is Planning to fail |
 |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-07-12 : 09:15:48
|
seehttp://www.mindsdoor.net/SQLTsql/ImportTextFiles.htmlThat will import any file as long as the row width is less than 8000 chars (you will come across some interesting bugs in bcp and bulk insert for longer rows).Change the merge sp to cater for moving the data to the tables.also seehttp://www.mindsdoor.net/SQLTsql/MoveImportData.htmlfor doing tthe move based on metadata.==========================================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. |
 |
|
|
|
|