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.
[…] Now, you just need to generate the script (data only) of the table ([tbl_Department_Sample]) using Generate Script feature in SQL Server 2012 and […]
Thanks a lot! Just what I was looking for.
I just want the same thing but using command prompt. Can you please help me with some command (not any software) by executing which from command prompt can generate the same schema and data dump into a .sql file?
Thnak you very much for this nice article… It helped me a lot.
i need for 2012 not for 2008 rd
You can use this solution for SQL Server 2012. https://raresql.com/2012/09/30/generating-insert-statements-in-sql-server-2012/