views:

94

answers:

3

I'm trying to export the schema of my database so another developer can have it. On the SQL Server management Studio, if I right click on the database I see a "Script database as" -> "CREATE to" but that generates something like:

...
CREATE DATABASE [Name] ON  PRIMARY 
( NAME = N'Name', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\Name.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'Name_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\Name_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

instead of the CREATE TABLE statements. How do I get that?

+4  A: 

Use the scripting wizard for that and select all objects. Right click on your database-->tasks-->generate scripts pick DB and check off "script all objects in the selected database".

SQLMenace
A: 

Under Tasks->Generate Scripts

Cody C
+1  A: 

Hi,

Try this-

Right click on the database, opt for 'Generate Scripts...' under 'Tasks' menu item. This would launch the 'Script Wizard' window. You can then proceed from there as it is very much intuitive.

This would allow you to select all objects in your database and would generate scripts for all of them. Finally the scripts can be saved to a file or viewed in a query editor.

cheers

Andriyev

related questions