Scripting out Data from a table as INSERT statements

Everyone know how to script out a definition of a table. However many do not aware that you can script out data as well in the form of SELECT statements

This option is available only from SQL Server Management Studio (SSMS). 

Here is what you need to do

Right click on database

–>tasks–>Generate scripts–>click next–>Choose specific database_objects

Now check out the tables you want to script data out

Choose one of the saving options (file, clipboard,etc).

Click Advanced and in the drop down for label Type of data to script , choose the value Data only

Click next. You get all the data in the form of SELECT statements

Here are the pictures for easy understanding

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s