Monday, November 29, 2010

Sql Server 2008 : Generate Data Script


SQL SERVER 2008: HOW  TO CREATE TABLE DATA SCRIPT ???

(NOTE: There is no such facility in Sql Server 2005. But still you can create table data script http://connectsql.blogspot.com/2009/09/generate-tables-data-script.html)

Sql Server Management Studio 2008 provides easy approach to generate your data script. The resultant script will be in INSERT INTO statements format.


To achieve our goal, first right click on your desired database; select “Tasks”, then select “Generate Scripts …”

Click on your desired database name from given list and click “Next” button.

Next options page is import. Turn off all options except following and then click “Next” button
“Schema qualify object name” (for two part name i.e. schemaname0.tablename),
“Script USE DATABASE” (I will give an additional line of USE YourDatabaseName before your data script)
“Script Data” (To generate data script only)

Turn on check box of “tables” and click “Next” button
 
 
Select your desired tables or you can select all tables by click on SELECT ALL button, given on bottom of the page. Click “Next” button twice to continue.

Let it work till it generates success message. Click “Close” button to complete.








2 comments:

  1. How to generate script programitically same as generate script output

    ReplyDelete
  2. how to generate script pragramatically same as above manual procedure ... without using wizard

    ReplyDelete

All suggestions are welcome