SQL Server – View Delete Statements in the Transaction Log

sql serversql-server-2008-r2transaction-log

Is it possible to view delete statements that have recently occurred in the Transaction Log?

Best Answer

you wont find the exact scripts that were executed on sql.(in the transaction log)

A transaction log is a file that contains information regarding every change that has been made to the database. This includes data modifications (transactions), database modifications, and backup/restore events.

The primary purpose the transaction log is to provide a method to be able to restore a database to a point-in-time when necessary. This can include rolling back transactions to a certain time, or to roll forward transactions from a full backup restoration.

to know more about Transaction log http://www.sqlservercentral.com/articles/Design+and+Theory/63350/

here is a script to show you recent ran delete queries

SELECT deqs.last_execution_time AS [Time], dest.TEXT AS [Query]
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
where dest.TEXT like '%Delete%from%'
ORDER BY deqs.last_execution_time DESC