Tuesday 22 March 2011

How to Generate the Scripts for Table with data in sql server 2011

Steps requied to generate Script in MS-Sql Server 2011:

  1. Click on database. Right click on database and open context menu.Select Tasks > Generate Scripts... from displayed menu.

  2. Microsoft SQL Server 2011 Generate and Publish Scripts wizard is displayed. Click on Next buton.

  3. We are going to choose database objects that we want to create scripts for. If you want to script data of a single sql table, choose the "Select specific database objects" option. If you want to generate script for all database objects in the target database you can choose "Script entire database and all database objects". Click on Next button

  4. Next we will configure scripts in detail and save or publish options.If you want to display the generated data script in the SQL Server Management Studio Query Editor window.

  5. The most important configuration here in this screen is configuring the script wizard to script data. So please click Advanced buton. In the Advanced Scripting Options configuration screen, find Types of data to script parameter. The default selection is Schema only script type. In order to script data in table in SQL Server, you can either choose Data only script type or Schema and data script type.

  6. After you completed your advanced scripting options selection, click OK buton. Then click Next buton. Click Next buton if everything is correct. Or click Previous buton to reconfigure generate script data options.

  7. The Generate and Publish Scripts wizard, executes the task and displays each step and the result of the task execution.

  8. Click Finish buton to close the SQL Server 2011 generate script wizard.

No comments:

Post a Comment