Restore Objects Only

  • How do I restore just the object definitions for a database without restoring all the data?

    Tim White

  • 2 options

    1. You can generate script of db of all objects.

    2. Restore db and truncate tables by a loop with order as details tables data first and master tables data later.

    Hope it will help u..

  • You actually can't truncate a table that is a parent in a foreign key relationship even if there is no data in the child table. You either have to drop the FK's or do a deletes.

    The better way is to just generate the scripts and run them.

  • generate a script from the backup file? not sure how to do that. The reason I want to do this in the first place is because I lost some indexes, etc... and need to get them off the backup file, ie... restore to a new named database (without restoring all the data), then script out the DDL.

    Tim White

  • 2 Tim 3:16 (11/25/2008)


    generate a script from the backup file? not sure how to do that. The reason I want to do this in the first place is because I lost some indexes, etc... and need to get them off the backup file, ie... restore to a new named database (without restoring all the data), then script out the DDL.

    No way to do it from a backup file. It seems that you'll have to restore the whole database and then check the indexes on the tables. By the way did you consider working with a version control tool? This would be very helpful in a case like this.

    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/

  • I think SQLCompare (Red Gate) will do this. There is an option to compare to a backup file.

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

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