Solved

Database Structure

Posted on 2009-07-07
4
332 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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