"Clone" a database

  • We need to create a new empty database B which should have the same elements (tables, views, stored procedures etc) as an existing database A.

    Is there another way than using scripts to create each element one by one?

    Thank you very much.

  • Dinu E Anastasiu (3/19/2008)


    We need to create a new empty database B which should have the same elements (tables, views, stored procedures etc) as an existing database A.

    Is there another way than using scripts to create each element one by one?

    Thank you very much.

    Why not just script the database and execute it. That would be the easiest way to do. Else you can use third party tools like Redgate's SQL Compare to move the database schema.

    SQL DBA.

  • Using the scripts is the "shortest" way.

    You could also restore the database with a new name and then

    delete all datacontent using truncate table or delete from table.

    (watch out for FK tables)

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

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

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