Jump to content

Wikipedia:Reference desk/Archives/Computing/2023 August 21

From Wikipedia, the free encyclopedia
Computing desk
< August 20 << Jul | August | Sep >> Current desk >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


August 21

[edit]

Microsoft SQL Server: Is it possible to find out the SQL command which triggered deletion?

[edit]

We are having a problem at work. We are developing a .NET C# application that uses a Microsoft SQL Server database. Reports from customers are routinely showing that rows from a database table are disappearing sporadically. We can't reproduce this at our own end.

My colleague has added a database trigger that fires every time a row from the table is deleted and outputs the time of its deletion, and I have taken it to use in the code. But this might not be enough to debug the problem. Is it somehow possible to find out which actual SQL command it was that triggered the deletion? JIP | Talk 21:01, 21 August 2023 (UTC)[reply]

Here is a web page that might be what you're looking for: [1] It doesn't show getting the SQL command exactly, but it shows how to find the delete action in the log and then how to use that to find the database user that ran the delete command. Maybe that will point you in the right direction? RudolfRed (talk) 00:09, 22 August 2023 (UTC)[reply]