Mystery Row Deletion

  • I am running a vb.net app against our SQL DB and somehow some of the rows in a table got deleted. The rows all had the same foreign key and related to one object. There is no code anywhere in the app that would accomplish this deletion and I am at a loss as to how the rows got deleted. I am also unable to get this mystery deletion to occur again. Is there any way to find out how these rows got deleted?

  • Not unless you have some form of auditing in place already.

    Did someone perhaps delete and recreate the 'object'? If you have cascading delete, that may have caused it.

    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
  • Thank you for your reply. I dont believe it is possible for someone to delete the object and recreate it, but that would make sense as a possible explanation. Unfortunately there is no auditing in place for delete in this table, but I am also unsure if that would help this issue. I dont think there are any values that would help in finding out how rows get deleted as the app uses the same user account all the time. I am also unsure if it was even in the app the delete was called from as there is no code that uses delete. Are there any other specific values that may help in identifying how the rows may be deleted in the future? Thanks again

  • Is it possible that you have cascade delete set up on the table? That might explain rows being deleted seemingly without action.

    If you want to try to catch what's happening, I'd suggest putting a trace on to the database to capture transactions for a while. The next time it happens then, you could check the calls being made, by who, etc.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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