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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to bulk insert a text file with no row terminator and fixed row

Status
Not open for further replies.

Shab

Programmer
Oct 9, 2001
60
US
Hi All,

I have a file that has fixed row size of 148 and fixed column size, but the file has no end of line character. I know it is wierd but a client has made the file and refuses to change the format. So I am stuck with reading it the way it is.
In Enterprise Manager, I used the Import/Export wizard and I specified fixed length and it let me specify 148 as the lenght of each line. Then it recognized the file and I was able to read it in.
I saved the DTS package and I can run it over and over again using dtsrun. However I want to do the same thing using Bulk Insert. How do you specify fixed row length for Bulk insert and how do you give it individual column lengths?

Thanks,

Shab
 
I think you may be able to achieve this using a format file - which BULK INSERT uses in same way as bcp.

Extracted from books on-line:

BULK INSERT pubs..authors2 FROM 'c:\new_auth.dat'
WITH (FORMATFILE = 'c:\authors.fmt')

You can create the format file with a text editor or with bcp itself I believe.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top