Importing Data from a space delimited text file with column headers in a separate file
Posted on 2004-09-10
We have a large amount of data (4 Gig) to import to a SQL database. The column headers, data types, and offsets for the space delimitations are in a different file.
If we use the SQL GUI Import Tool we would have to manually set each delimiter. There are about 450 columns in the database so this would be extremely time consuming and tedious. I'd like to know if it is possible to do the insert at a command line, maybe with query analyzer, or another way.
The second file with the column headers and stuff looks like the following:
05 Column1 PIC X(10) NOTE OFFSET 0.
05 Column2 PIC X(10) NOTE OFFSET 10.
05 Column3 PIC X(10) NOTE OFFSET 20.
05 Column4 PIC X(10) NOTE OFFSET 30.
05 Column5 PIC X(10) NOTE OFFSET 40.
Each of these first few columns are all 10 characters in lenght, but later on, they change from anywhere 1 to 20.