Repair a MSSQL Database

Repair method can be used to repair a corrupted database if the database has corrupted rows. Corrupted rows can be deleted by passing in the Delete corrupted rows Repair Option. If you do not want to do this then the corrupted rows can be recovered by passing in the Recover corrupted rows Repair Option. Use the following command.

engine.Repair(null, RepairOption.RecoverCorruptedRows);

By setting the case sensitive property in the connection string property of the repair method you can also create a case sensitive repaired database. Enter the command below to create a case sensitive database.

engine.Repair("Data Source= Test.sdf; LCID= 1033; Case Sensitive=true;", RepairOption.RecoverCorruptedRows);

This entry was posted on Thursday, January 15th, 2009 at 11:48 pm and is filed under VPS hosting, Windows VPS hosting. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply