Exporting procedures and views, recover after a crash

  • Hi,

    I have a problem trying to restore after a crash.

    I have a database wich I have a full export working in emergency mode to a complete new database.

    This database doesn't receive the primary keys, store procedures and views.( I don't know if this is normal).

    I have some older version of the same database, so I want to recover from that the structure ( including primary keys, store procedures an views) and the data from the actual database recovered.

    One way its to generate the scripts, but I'm worried about the creation order of thje store procedures ( I don't know deeply the database, its about 500 tables).

    The second choice I'm evaluating it's to restore the old database, delete every table ( only the data), then import the data from the actual database.

    Please give you opinions, if you think the second choice it's better, please give me some advice about the better way to delete all data in every table.

    Thanks in advance,

    Luis

  • It sounds like you don't actually have a backup of the database that you want to recover.  Is that correct? 

    If true, then I would go with your second option i.e. restore a backup of the 'old' database to get the table structures, truncate the tables, and import the data from the database that has current data.

    use sp_msforeachtable 'TRUNCATE TABLE ?' to truncate all the tables in the database.

    Greg

    Greg

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

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