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 - 2002-09-26 : 08:28:16
|
| Srinivas Reddy writes "Hello,I'm having some data as shown below in varying textfiles ( of various names)1,94000252,91845996, MEERA KHATAK ,18,940002522,94000252,97050199, PROMILA MATHUR ,18,94000252I've a table called TABLE1 with 6 columns.Using following BULK INSERT statement, I succeded in getting the records from textfile to the table.exec ('BULK INSERT TABLE1 FROM ''c:\gene\11999284.txt'' WITH ( DATAFILETYPE = ''char'', FIELDTERMINATOR = '','', ROWTERMINATOR = ''\n'', KEEPNULLS)')Now I've some other table with more number of columns than 6, and I don't want to increase the columns in the textfile.And I want to use BULK INSERT Method for this. Could some body please come with possible solution on how to go about it?Thanks in advance.CheersSrinivas Reddy" |
|
|
jasper_smith
SQL Server MVP & SQLTeam MVY
846 Posts |
Posted - 2002-09-26 : 09:13:30
|
| 1) Use a view2) Use a staging table (always a good idea)3) Use a format file for the BULK INSERTHTHJasper Smith |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-09-26 : 09:57:54
|
| I would go with1) and 2) together.Stick a datetime default getdate() and an identity on the staging table so you know when and in what order things happened.Don't like format files - they get messy.==========================================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. |
 |
|
|
|
|
|
|
|