THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | Join | Help
in Search

The Bit Bucket (Greg Low): IDisposable

Ramblings of Greg Low (SQL Server MVP, MCM and Microsoft RD) - SQL Down Under

Backup a Single Table in SQL Server using SSMS

Our buddy Buck Woody made an interesting post about a common question: "How do I back up a single table in SQL Server?"

That got me thinking about what a backup of a table really is. BCP is often used to get the data but you want the schema as well.

For reasonable-sized tables, the easiest way to do this now is to create a script using SQL Server Management Studio. To do this, you:

1. Right-click the database (note not the table)

2. Choose Tasks > Generate Scripts

3. In the Choose Objects pane, select the table you want to script

4. In the Set Scripting Options pane, click Advanced.

5. In the Types of Data to Script option, choose Schema and Data. (If you also want indexes, etc. make sure they are also chosen)

Click your way through the remaining screens and you're done.

Published Monday, June 07, 2010 6:18 PM by Greg Low

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Twitter Trackbacks for The Bit Bucket (Greg Low): IDisposable : Backup a Single Table in SQL Server using SSMS [sqlblog.com] on Topsy.com said:

June 7, 2010 3:11 AM
 

Jason Haley said:

Interesting Finds: June 7, 2010

June 7, 2010 6:20 AM
 

Markus Tamm » Blog Archive » 09.06.2010 said:

June 9, 2010 3:11 AM
 

cany said:

Hi,

Why I can not see 'Advanced' button in step

4. In the Set Scripting Options pane, click Advanced ?

Thanks.

June 9, 2010 2:45 PM
 

Uzzie said:

Hi Cany,

If you are using SSMS 2008, steps that you need:

- Right click on the DB

- Choose "Tasks" and then "Generate Scripts" and "Script Wizard" dialog box will appear. Then click NEXT.

- Choose DB (don't know why it ask you again?? :P) and NEXT.

- You are at "Choose Script Options" page now. Scroll down to "Table/View Options" and you'll see "Script Data". Set to TRUE if you want to backup the data in the table too. You can also choose other options as you wish. Hit NEXT.

- Select object you want to script.

- Follow the rest of the instruction.

Cheers,

Uzzie

June 10, 2010 9:58 PM
 

Deepika said:

Helpful!!!Thanks:)

August 5, 2011 5:32 AM
 

Mahant said:

Thanks, it helped.

August 9, 2011 12:56 PM
 

Hammad said:

Does not work in MSSQL Management Studio 2005. It scripts only structure and schema no data.

October 14, 2011 4:36 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement