HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to fetch the transaction activities/logs for a specific table?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thelogsactivitiesfetchtransactionforhowspecifictable

Problem

I can see the transaction logs with fn_dblog, but I need to do this for specific table. How can I do that?

Solution

You could try the following:

Retrieve the id for your user table:

SELECT id, name FROM sys.sysobjects WHERE NAME = ''


e.g. 658101385

Retrieve the Transaction Log information with the undocumented function:

SELECT * FROM ::fn_dblog(NULL,NULL) WHERE [Lock Information] LIKE '%658101385%'


And then carry on from there.

Reference: Identifying Object Name for CREATE and ALTER Using fn_dblog()

Code Snippets

SELECT id, name FROM sys.sysobjects WHERE NAME = '<Your_Table_Name>'
SELECT * FROM ::fn_dblog(NULL,NULL) WHERE [Lock Information] LIKE '%658101385%'

Context

StackExchange Database Administrators Q#185678, answer score: 6

Revisions (0)

No revisions yet.