Did you know, SQL Server 2008 Management Studio has an in-built option to generate a script that can help you restore an entire database alongwith the data? Compared to a .BAK file that can also be used to restore a database, a script lets you peek into the schema AND data (INSERT statements for rows within tables are automatically generated) before you restore it.
Unfortunately, this cool feature is hidden under layers of options and isn't easily discoverable unless a really discerning user points it out.
Steps to generate script:
1. Right click on a database name, choose Generate Scripts.. option under Tasks.. in the context menu
2. In the Generate and Publish Scripts wizard which appears choose the database object for which you want to generate a script
3. Under the Set Scripting Options, make sure to click on the Advanced button which reveals a bunch of more options.
4. In the new dialog box that opens up, scroll down to the last option in the General category and for Types of data to script, choose Schema and Data
Related:
HOW TO view parameter values of a stored procedure through SQL Profiler
Why are these Visual Studio Settings not enabled by default?
Monday, 26 December 2011
HOW TO back up a database (schema and data) as a SQL Server script
Posted on 06:48 by Unknown
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment