Generating Insert script with data for a table in SQL Server

If you want to generate the insert script for a table in SQL Server along with the data , you can do that by setting the “Types of data to script” to data only at the database level in the SQL Server Management Studio.

How to generate INSERT script with data for a table in SQL Server ?

1. Launch SQL Management Studio and connect to the SQL Server instance.

2. Right click on the database and select “Tasks -> Generate Scripts”.

image

3. In the “Generate and Publish Scripts” dialog window , select the table for which you want to generate the scripts. In the Set Script options , click “Advanced” button and  select “Data Only” from the “Types of data to script” dropdown list.

image

4. Click OK and continue with the steps shown in the Wizard. This should generate the INSERT script for the s elected table.

Leave a Reply