How to create automatically a table populate script from current data in SQL Server?

17,567

Solution 1

Check out the SSMS Addins (for both SSMS 2005 and 2008):

alt text http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=SSMSAddins&DownloadId=48526

One of the tools included in the "DataScripter" which will script out INSERT statements for the table(s) you want to.

Solution 2

Old question, but I got to the question before figuring out a way to solve the problem. So I'm just posting the method here in case it might help anyone else.

In SSMS:

  1. Right click on db -> "Tasks" -> "Generate Scripts..."
  2. Click "Next" and, at "Choose Objects" step, select the specific table
  3. Click "Next" and, at "Set Scription Options" step, click "Advanced"
  4. Set value for "Type of data to script", depending on what you need
  5. Continue to finish

Solution 3

Maybe this is just enough for you: http://snipplr.com/view/12003/generate-insert-statements/

Share:
17,567
Victor Rodrigues
Author by

Victor Rodrigues

Brazilian software developer, doing lots of Ruby code :D

Updated on June 16, 2022

Comments

  • Victor Rodrigues
    Victor Rodrigues almost 2 years

    Is there a tool that allows me to create a sql populate script for a table using its current data?