SQL Procedure to generate INSERT statements from the existing data sp_generate_inserts written by Vyas.

Usage:


exec sp_generate_inserts '[table_name]', @top=1, @Include_Timestamp = 1, @owner='[schema]'

Procedure to generate INSERT statements from the existing data

SQL 2008 Generate Script utility may generate Insert statements for all of the data in table.

  1. Right click on the database and go to Tasks -≷ Generate Scripts
  2. Select the tables (or object) that you want to generate the script against.
  3. Go to Set scripting options and click on the Advanced button.
  4. In the General category, go to Type of data to script
  5. There are 3 options: Schema Only, Data Only, and Schema and Data. Select the appropriate option and click on OK.