i would like to duplicate structure of one SQL database to new one, how i am doing that?

Posted on 2011-10-23
Last Modified: 2012-05-12
i am working with "Microsoft SQL Managment Studio 2008"
what are the steps?

Question by:gvilbis
    LVL 38

    Assisted Solution

    by:Aaron Tomosky
    Right click the server name, restore db, choose the other db as the source.
    LVL 23

    Accepted Solution

    Backup source database and restore over new. If you have any objects in new database, create script for that one and execute later.
    Delete any data that is not required for new database. Better truncate table, which will reset IDENTITY columns as well.

    Open in new window

    If you have foreign key constraints, DELETE should start from child tables.


    Generate Scripts for all objects and execute one-by-one

    LVL 21

    Assisted Solution

    by:Alpesh Patel
    to truncate all tables
    execute 2-3 time until script execute without error.

    EXEC sp_MSForEachTable 'TRUNCATE TABLE ?'

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
    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…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now