I am using sql server 2008 management studio and i want to migrate my table to a different database server

Is there any way to export the data as an insert in a sql script? ?

Best Answer


In ssms in the object explorer, right click on the database, right-click and pick "tasks" and then "generate scripts".

This will allow you to generate scripts for a single or all tables and one option is script data If you set this to true the wizard will generate a script with an into statement for your data

If using 2008 R2 or 2012 it is called something else, see screenshot below this one

alt text

2008 R2 or later eg 2012

Select "types of data to script" which can be "data only", "schema and data" or "schema only" - the default).

enter image description here

And then there's a " SSMS Addin " Package on Codeplex (including source) which promises pretty much the same functionality and a few more (like quick find etc.)

alt text