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 |
|
anthonyboud@yahoo.com
Starting Member
1 Post |
Posted - 2005-03-27 : 05:20:23
|
| I have a fixed length text file that I wish to import into SQL tables.The text file will contain 2 different types of records. Firstly, aheader record, which is immediately followed by X number of detailrecords.Each record is 80 characters long, separated by a CRLF, and the typeof record is identified at the beginning (first 2 char's).I would like to insert the header records into a header table,returning the unique ID (auto incrementing ID) of the row insertedinto the header table, which will be used when inserting theassociated detail records.Does anybody have any sample ActiveX scripts that do something similarto the above?Basically, I'm after an example script that opens a file, loops aroundeach row in the file and tests the data in some means.Any examples would be absolutely fantastic and much appreciated!Many thanks Anthony |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2005-04-05 : 08:02:35
|
| If your source file is of any significant size, it would be much quicker to bulk insert the whole lot into a staging table first and then process it within sql server.Mark |
 |
|
|
bclick
Starting Member
3 Posts |
Posted - 2005-04-06 : 13:39:26
|
| I have a similar task, but a bit more involved. No header line. I need to import my 9 million line (375 char max line len) text file into 6 different SQL tables, based on the first 2 chars. And the six different text lines are not delimited, but field-length defined, parsed into different columns in each table.ActiveX Case statement? Stored Procedure?Thanks - Bil |
 |
|
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
|
|
|
|
|
|
|