Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load a fixed length file into SQL 7.0 no delimiters

Status
Not open for further replies.

sandra64

Programmer
Jun 26, 2002
28
GB
I have a file and the columns are of fixed length (cobol format). There are no delimiters in the file and I need to take it into SQL. I've looked at bulk insert but this needs you to specify the delimiter.

I could copy it somewhere and edit it to insert delimiters but I don't really want to do that.

If anyone can help it would be much appreciated.

cheers
 
Hi
bulk insert is actually the best way (although you can use DTS as well - DTS lets you choose between delimited and fixed length text files)

check out format files in BOL. You can definitely use it with fixed length files

BULK INSERT <tablename> FROM <filepath> WITH (FORMATFILE = <formatfilepath>)

Hope this helps
LFCfan
 
If your file is just one long string then why not 'parse' it with substring functions and cast numbers to numeric fields
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top