LINKS  

ApexSQL Knowledgebase

Tips and How-to Articles for ApexSQL Tools


Why ApexSQL Recover doesn't recover indexes, primary keys and identity for drop data recovery

DESCRIPTION
When I try to recover data from a drop table operation, ApexSQL Recover does not generate code for the primary key and other indexes.

SOLUTION
When doing recovery data lost, the simplest form of table schema is recovered on purpose. No IDENTITY, NULL/NOT NULL flags, primary key, default values or indexes are created - just column names with its data types. This is done because recovery process is not always unambiguous and can lead to duplicated rows depending on the database state. If we were to recover full table structure (as we did originally) it could lead to conflicting INSERT operation and possible data loss at the level of script. On the other hand, since the full table structure is generally known to the users, anyway there is no real loss - after the recovery the table just needs to be manually updated to its proper structure.

AUTHOR
Dmitriy Dyubchenko

LAST REVIEW DATE
17 August 2009

Labels:



© 2010 ApexSQL LLC All Rights Reserved | 1.919.968.8444 | Contact Us | Terms of Use | Privacy Policy