November 25, 2008 at 7:43 am
How do I restore just the object definitions for a database without restoring all the data?
Tim White
November 25, 2008 at 7:53 am
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..
November 25, 2008 at 7:54 am
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.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
November 25, 2008 at 7:58 am
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
November 25, 2008 at 8:09 am
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/
November 25, 2008 at 10:19 am
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