it would be best to add the sql server 2005 zone to your question for more sql expert advise
Main Topics
Browse All TopicsI have a small application in Delphi 7. I am doing a bulk insert in Sql Server2005. I have more than 2000 insert statements in a text file.
I load this text file in the TAdoQuery component and Execute TAdoQuery.
But it seems that only the first 456 records are getting inserted.
Please find the code below and the text file attached.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Having a whole series of INSERT statements is a common "solution" used by developers who are not familiar with databases and/or are not comfortable with set-based thinking rather than process oriented thinking (i.e. SQl vs Programming Languages ;-). It would be far better if you were to format the data as a CSV file and use SSIS to load the data into the SS2005 table.
If nothing else, create a unit that reads teh CSV file and fills in the parameters for a parameterized query and then executes the query. However, that will be slower than your idea of executing the massive SQL script (although, probably more successful). The fastest and best solution is the use of SSIS.
rewriting and getting possible errors ?
just run the script from the command line :
http://www.mssqltips.com/t
>>I solved my insert issue by creating a storedprocedure and adding the insert statement inside the storeprocedure and then executing the storeprocedure.All this is done at runtime.
cool, should indeed work faster
don't forget to drop the procedure when finished
the idea is indeed like uploading the script to the server and then letting the server execute it local
Business Accounts
Answer for Membership
by: Geert_GruwezPosted on 2009-09-08 at 06:57:33ID: 25281886
there is a limit on sql statements of 8000 bytes
you'll have to divide the sql into pieces