Love Script as Insert, but just found odd behavior
GarryB
Posts: 29 Bronze 1
in SQL Prompt
I was just doing some work and using the handy feature script as insert.
So I ran a select top 1000 query and get the following scripted insert output:
I then realized the table had more than a 1000 records and I increased my TOP to 10,000.
Then I get this output for the script as insert:
So for everything over 1000 that format of the insert would make it hard to strip out the value for each row which is what I was trying to do.
Is this by design?
So I ran a select top 1000 query and get the following scripted insert output:
I then realized the table had more than a 1000 records and I increased my TOP to 10,000.
Then I get this output for the script as insert:
So for everything over 1000 that format of the insert would make it hard to strip out the value for each row which is what I was trying to do.
Is this by design?
Tagged:
Answers
Thanks for getting in touch. Yes you are 100% correct, the maximum number of rows you can insert in one statement is 1000 when using INSERT INTO ... VALUES ... . When there are more than 1000 rows we use the full INSERT syntax.
I've got a couple of quick questions if that's okay:
Would you prefer the full INSERT statement to be on the same line? Are you able to achieve that with the formatting settings? What's the procedure to "strip out the value for each row"?
Best,
Michael
Technical Lead, SQL Monitor
I actually just need the actual data in the () for what I am trying to accomplish.
So I ended up breaking it up. Do 1000, then sort desc and grab the extra 346 values.