SQL Server 2008 has a neat feature that allows you to script out
an object. Not really ground breaking so far. However, where this
differs from SQL 2005 is that you can script out:
- the schema
- the data
- the schema & data
You would think this option is available to you by right
clicking directly on the object (typically a table for scripting
out data and schema) but it isn't - you have to start on the
Right click on your database and select
This will fire up a wizard to generate the scripts for
Click Next and you will be prompted to select
the objects you want to script out. I am going to choose one table
for this purpose as it's easier.
This is the important part, by default SSMS defaults to
Schema Only to amend this to include the data
you need to click Advanced
Now scroll down to the proprty named Types of data to
script and select an option from the drop down.
Click OK and follow the rest of the wizard.
And there you have it, a simple way to script out your schema
and data via SSMS 2008.
Note: If you are on SQL Server 2005 then I would recommend using
an add-on such as SSMS
Tools Pack as it includes this type of functionality which
isn't available pre SQL 2008.