SQL Server 2008 R2, an update corrupted my table somehow, likely to do with the storage subsystem. I am on a dev database, so aren't overly concerned about losing data, it isn't business critical. But I am writing a set of queries which will eventually be used on prod and the corruption happened in the middle. As I don't want to lose the previous changes (they took a while to complete), I decide I can run DBCC CHECKTABLE with the REPAIR_REBUILD option. Sure, restore from backup would normally happen on prod system, but I am on dev here and backups are virtually non existent. Anyway...
According to the spec here, this should be no problem, data will not be lost. It does state "Use as a last resort", but this appears to be mostly for constraint reasons. My table has zero constraints so it seems like this doens't apply here. But just to be safe, I wrap the statement in a transaction, ready for rollback.
I set the database to single user mode, then run the DBCC statement. A few queries work, data looks about right, so I committed the transaction.
However, on further investigation, the statement has done as it states - there is no data loss. But it has ADDED rows to the table. The rows are identical to existing rows and will require a delete to remove them. As fas as I can see, this is not stated in the msdn article above.
For me, this counts as data loss - I haven't technically lost rows, but particular rows have been altered from their original values. Namely - rows that did not exist before do now. Again, this isn't technically loss but it does constitute a change to the data which will cause queries to return different values (imagine SUM or COUNT queries).
Does anyone have any ideas how or why SQL Server would decide adding additional rows are fine?