question

Bhupendra99 avatar image
Bhupendra99 asked

Execute insert script having 10000 records

When I try to execute a Sql Script file having around 100000 records I get message as query completed with errors but if I run some statements in the file individually it happens So I end up executing the script bys selecting the part of the file and execute and remove and then move ahead Can anyone suggest how Can I execute the file in one go without getting any error messge
execution-count
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
Almost impossible to suggest any answer without knowing the error that you're receiving.
2 Likes 2 ·
Dave_Green avatar image Dave_Green ♦ commented ·
Can you confirm - *all* of the file works when run separately, just not when run together? Your question seems a little ambiguous on this point. Are you able to note the error messages you receive?
0 Likes 0 ·
Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
This web site runs off of votes. Can you please indicate all helpful answers below by clicking on the thumbs up next to those answers. If any one answer lead to a solution, please indicate that by clicking on the check mark next to that one answer.
0 Likes 0 ·
Tom Staab avatar image
Tom Staab answered
I agree with Grant's comment that we need to know the error you are receiving. Without that, any answer is at least partially a guess. That said, I can at least give you one suggestion based on my experiences at work. 1. Certain statements must be run in a separate batch, like creating schemas, procedures, and views. 2. Some statements (particularly some table alterations) need to be batched before other statements that require those changes. 3. Variables are batch-scoped. In other words, they are only valid between GO statements. I suggest you check your script for any of those scenarios. We would probably need to see your script to help much beyond that.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image
Grant Fritchey answered
On a vague guess, you're declaring variables multiple times so it's generating errors on the second, third, whatever, declaration.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.