Duplicating or Replicating the database structure

  • Dear All,

    I have a database in SQL Server 2000 and later versions.

    As my application deals with the data on yearly basis, the same database has to be replicated again without any data i.e only the structure and objects of the database.

    Is there any script to perform the same?

    Thanks a lot in advance.

    [font="Arial"]Nothing is impossible with Hard Work[/font]:)

  • To generate your scripts right click on the db in SSMS (2005) and click Tasks --> Generate Scripts..

    This will give you the scripts that are required to create your db objects on any database.

  • Dear Friend,

    Thank you for the assistance.

    But I have to do if from the front end so I want an option to exectue a procedure such that it will replicate the database in another name some times with data a some times without data based on the user requirement.

    [font="Arial"]Nothing is impossible with Hard Work[/font]:)

  • You can do backup and restore and then run delete statements according to your criteria. Another option is go generate the scripts, run the scripts and then import the data that you need to have in the new database.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply