SQL: How to copy Database from Local PC to Website (Publish Database to Web)

You can achieve this by using script services in SQL Management Studio. Generate script is used to publish a database to the Database Web Publishing Service. If you have a database with data and you want to copy to exactly with the same tables, stored procedure and database then follow the steps:

  1. Open Microsoft SQL Server Management Studio
  2. Exapand Databases–> Select and right click on the Database you want to copy
  3. Choose Tasks –> Generate Scripts

  4. Select tables or stored procedure and click –>Next
  5. On the ‘Choose Script Options’ screen–>
    1. Click Advance–>
    2. There is an option called –>Types of data to script
    3. By default Schema only is selected. In order to generate the insert command for the data select–>Schema and Data

(Note: for SQL Server Management Studio 2008 R2, the option is called “Types of data to script” and is the last one in the General section. The choices are “data only”, “schema and data”, and “schema only”)
alt text alt text

In 2008 R2 Database you have to select different option to do the same operation:

* Right clicking on the DB* Click on tasks* Click on generate scripts* Go through the wizard and select your tables* On the options page click the Advanced button* Change the "Types of data to script" option:

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s