Hello Friends,

In this article i will show you how to script the table data along with schema of the table. This feature is given as a new option in the Script Wizard of SQL Server 2008.

This is all GUI. SSMS(SQL Server Management Studio) will help you get all the data you need.

Please follow the below mentioned steps:

1_SQL_Server_Scripting_Data_along_with_Schema

2_SQL_Server_Scripting_Data_along_with_Schema

In this page you can choose the Database which you want to script.

3_SQL_Server_Scripting_Data_along_with_Schema

Script for Server Version: Here you can customize the output type as per your destination SQL Server Version.

4_SQL_Server_Scripting_Data_along_with_Schema

Script Data: Setting this option to TRUE might lead to some serious preformance issues,

based on the number of tables, Rows Selected & the H\w resources you have on your Box.

5_SQL_Server_Scripting_Data_along_with_Schema

6_SQL_Server_Scripting_Data_along_with_Schema

Here you can choose the tables which you want to script out.

7_SQL_Server_Scripting_Data_along_with_Schema

Here you get many options like Scripting to a file, clipboard or a new query window.

8_SQL_Server_Scripting_Data_along_with_Schema

Summary Page: Let’s you double-check all the options\objects before hitting the GO button.

if you read this carefully you’ll see i’ve choose to script the data but not the indexes, you can customize

the output based on your needs on the Choose Script Options Page.

9_SQL_Server_Scripting_Data_along_with_Schema

10_SQL_Server_Scripting_Data_along_with_Schema

and finally, this is how the result looks like.

My table was having many columns so it was difficult to show you all the columns in the same screenshot.

11_SQL_Server_Scripting_Data_along_with_Schema

12_SQL_Server_Scripting_Data_along_with_Schema

 

 

Regards

Sarabpreet Anand

Like us on FaceBook Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook

Follow me on Twitter  |  Follow me on FaceBook