May 29, 2019 at 10:23 pm
SQL Server 2014
Thought this may be useful to others so posting it in the fourm.
I didnt find an option in sql server management studio to generate insert scripts for data from an existing table.
So, Iam using the below script to generate insert statements for data from an existing table so that i can deploy it to a higher environment.
Output of the below will be 3 statements for each table. Run the middle statement which will generate the insert scripts. Then replace the middle statement with the insert scripts. Now the DML is ready for deployment.
You can run it for multiple tables simultaneously. In the below iam executing for 2 tables. (TABLE1 and TABLE2).
May 29, 2019 at 10:32 pm
I didnt find an option in sql server management studio to generate insert scripts for data from an existing table.
There is an option, but it's well hidden.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
May 30, 2019 at 3:53 pm
Thanks Phil. that was very helpful.
May 31, 2019 at 8:54 am
See the Thread :
https://www.sqlservercentral.com/forums/topic/sp_generate_inserts
Sp_generate_inserts can still be found. It does generate inserts scripts and has a lot of options. It can be called from a script or a stored procedure. Some other suggestions are done in the thread for some alternate methods.
Ben
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply