Find the latest update on tables by user

SELECT spid,
[Current LSN],
[Operation],
[Context],
[Transaction ID],
[Description]
INTO #temp
FROM
fn_dblog (NULL, NULL),
(SELECT
[Transaction ID] AS [tid]
FROM
fn_dblog (NULL, NULL)
WHERE
[Transaction Name] LIKE ‘%%’) [fd]

WHERE
[Transaction ID] = [fd].[tid] and [Description] like ‘%update%’;
GO

—————————————————-
create table #tmp

(

spid int, ecid int, status varchar(50),loginname varchar(50),

hostname varchar(50),blk int, dbname varchar(50),

cmd varchar(150), request_id int

)

insert into #tmp

exec sp_who
—————————-
select * From #temp join #tmp on #temp.spid = #tmp.spid

drop table #temp
drop table #tmp

Leave a Reply

Your email address will not be published. Required fields are marked *