Export data from corrupted table

  • I have a table that has inconsistency errors.

    There are around 13 million rows of data in it.

    1. If I truncate this table and run a dbcc, would the errors disappear?

    2. Is there a way I can copy the latest 1 million or half a million rows of data through export data wizard or through select * into?

  • Benki Chendu (9/18/2013)


    1. If I truncate this table and run a dbcc, would the errors disappear?

    If the errors are only in that table, yes.

    2. Is there a way I can copy the latest 1 million or half a million rows of data through export data wizard or through select * into?

    Filter by the clustered index key and query in batches. If a query hits the corruption it will fail, so you won't be able to do a select * without a where clause.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks Gail.

    Is there a query for the 2nd point?

  • SELECT <column list> FROM <damaged table> WHERE <clustered index key column> BETWEEN <some lower boundary that works> AND <some upper boundary that works>

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 4 posts - 1 through 3 (of 3 total)

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