Copy database schema only

  • I have a development database that contains 1000's of records. I'm ready to ship my app to a new client. SO I'd like to know how best to create a new Empty database that has all the field names and relationships but none of the data.. also will my Primary keys be reset to 0? in this new blank database.

  • Script out all objects of your database and ship the script to the customer.



    Pradeep Singh

  • Yes of course a script would be best. I am using sql2008 what are the steps to create this script?

  • Get a comparison tool (Redgate SQL Compare, ApexSQL, etc...).

    Create a new blank database and perform a schema comparison between your existing database and the new blank database. Save the script that is generated from the comparison - just in case.

    Execute the script - or synchronize, however you want to do it. Now, you should have a ready made database with the full schema and no data. Back it up and restore it, or detach/attach it whichever works better for your installation method.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Thanks Jeffrey. I'll investigate the compare options but first please clarify "create a new database" Do you mean manually recreate each table one field at a time?. Is there a way I can copy my existing database schema quickly without the data.??

    I'm a newbie this must be one of the most simple things to do with a script yes? I just don't know what to do to generate the script.

    Do you have an example of what the scrpit might look like?

  • Not 'create a new database', but 'create a new blank database'. That is, a database with nothing in it at all.

    When you perform the comparison between your existing database with all of the objects (tables, views, procedures, functions, users, roles, etc...) and a database that has none of those - the comparison tool will build the synchronization scripts to make both databases exactly the same.

    Since you are performing a schema comparison and not a data comparison, the synchronization script is only going to create the objects that you identify. Those objects are created without any data.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

Viewing 6 posts - 1 through 5 (of 5 total)

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