Solved

Database Structure

Posted on 2009-07-07
4
324 Views
Last Modified: 2012-05-07
hi

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 ?
0
Comment
Question by:Pure_Heart
  • 2
4 Comments
 
LVL 26

Accepted Solution

by:
Chris Luttrell earned 250 total points
ID: 24799423
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.
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 24799724
You can also use a tool like ApexSQL's SQLScript
www.apexsql.com
0
 
LVL 26

Expert Comment

by:Chris Luttrell
ID: 24799732
If 3rd party tools are an option, I use and recommend Red Gate's SQL Compare to move/copy databases.
0
 
LVL 14

Expert Comment

by:Jagdish Devaku
ID: 24800836
There is another good tool that i am using is SQL Delta...
www.sqldelta.com
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...
http://www.karaszi.com/SQLServer/info_generate_script.asp
bye.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question