• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 349
  • Last Modified:

Database Structure


if i have a MS SQL 2008 database and i wanted to copy the structure without the data in it how can that be done ?

and is it possible to get the creation commands in a script file to run it inside an application ?
  • 2
1 Solution
Chris LuttrellSenior Database ArchitectCommented:
In Management Studio, right click the database, then Tasks, then Generate Scripts.  That will get all the structure in the database but no data.  Creates a file you can save and use where you need to.
You can also use a tool like ApexSQL's SQLScript
Chris LuttrellSenior Database ArchitectCommented:
If 3rd party tools are an option, I use and recommend Red Gate's SQL Compare to move/copy databases.
Jagdish DevakuSr DB ArchitectCommented:
There is another good tool that i am using is SQL Delta...
The only thing you need to do before using this tool is.. you need to create a database on the target server.
Generating scripts might give you issues while creating the foreign key between the tables.
so i first suggest you to seperate the foreign key scripts from the main scripts file that is generated by Generating scripts from ssms. Now run the mail script file that dont foreign key scripts and then run the foreign key scripts.
check the below link which might help you...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now