Recently, I wrote an article on “Generating Insert statements, data & schema using SQL Server Publishing Wizard”. It is a very nice tool to generate insert into statement from table data.
In SQL server 2012, the feature of this tool plus additional features are provided. Lets proceed step by step to generate insert into statement from table data in SQL server 2012.
Step 1 :
In the first step, you need to right click on Databases >> Tasks >> Generate Scripts…
Step 2 :
This is the welcome screen. If you don’t need this screen again and again you can check on “Do not show this page again”.
Step 3 :
In this step, you need to generate the script for one object or all objects available in the database. You can further drill down if you need to generate any table. For example :
Setup 4 :
The next step is to define the script location, clip board or in a new window. In the same step, if you click on Advanced button, it will give you further control on scripting.
This is the advance screen, in this screen you can choose whether you need data, schema or data and schema scripts.’
But if you need only Insert into statement from table data, you must select data only. By default it is schema only.
It also allows you to select the SQL version.
Step 5 :
In this step it will display the summary of your selection. If you need you can go back and change the settings.
Step 6 :
In this step, it will display the result.