Friday, June 29, 2012

Script SQL Server Database (schema and data)

This blog post explains how to use SQL Server Management Studio to generate scripts (schema and data) for SQL Server 2008:

In SQL Server 2008 R2, the options have changed slightly. There is no "Script Data = True/False" option. Instead, look under General options for "Types of data to script". The default is "Schema only", but the other options are "Data only" and "Schema and data". Choose the "Schema and data" option to generate scripts that create the tables and then populate the tables.
  1. Login to SQL Server Management Studio 2008 R2
  2. Navigate to your database
  3. Right-click your database and choose Tasks ... Generate Scripts
  4. Click Next> past the Introduction
  5. Choose the entire database or specific tables/objects
  6. Click Next>
  7. Choose the desire file location and options
  8. Click Advanced
  9. Under General options, find Types of data to script
    1. Change value to Schema and data
    2. Click OK to close options
  10. Click Next>
  11. Review Summary
  12. Click Next>
  13. Click Finish

No comments:

Post a Comment