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!

Bulk Insert Error

Status
Not open for further replies.

opo

Programmer
Jul 30, 2001
56
US
I'm trying to bulk insert a textfile into a sql server table.
The message I get is unexpected end-of-file error
Should there not be one at the end of a text file.
Please help!!
 
This usually means that SQL Server didn't find the number of columns that were expected. Is the input file fixed length or delimited? If fixed length, does the format file properly describe the input file? If delimited, does each row contain the same number of delimiters and columns? Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Sorry, it took awhile to respond, had to research what you were talking about with a format file.
I am a VB programmer and i have to add records to an exisitng Sql table from a text file. There could be anywhere from 40,000 to 100,000 records in each txt file.
Currently i do this with an insert statement, but this can take as much as an hour, I'm trying to find a quicker way.
Any suggestions?
Also trying to implement triggers across server but keep running to an error.
 
Clarify please. Does the error occur in the VB program or in a SQL BULK INSERT statement? Do you have answers for the questions I asked previously?

SQL Server provides three methods for importing data quickly - BCP, DTS and Bulk Insert. All can process hundreds of records per second. SQL Books Online (BOL) contain descriptions, syntax and samples.

If you have a specific question about triggers, please post it in another thread. Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
The file is fixed length. I did not have a format file.
The errors are in the bulk statment when doned in the Enterpriser Manager. The VB program works, just slowly.
And I will send another post regarding the triggers.
 
When you say you are using Entreprise Manager, do you mean you are importing the file, creating a DTS package, creating a stored procedure using the BULK INSERT statement. Exactly what is the SQL Server process you are using?

Any of the methods I mentioned will generally import a file of the size you mentioned in a few seconds. Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Played around with DTS packages for two days, I now understand how to do it. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top