tags:

views:

120

answers:

2

Is there any way of tracing user's identity when he/she triggers a a delete trigger on T-SQL 2005, e.g. with UNIQUEIDENTIFIER? If I do record the UNIQUEIDENTIFIER, how do I trace it back to the user?

+2  A: 

You could store @@SPID at the time of the trigger and trace back to the user using sp_who

cmsjr
+2  A: 

take a look at suser_sname() or user_name() for windows/sql login, of course if everyone uses the same login this won't help you

the deleted pseudo table will have all the rows that are to be deleted so in the worst case you can offload those somewhere else in case you need to get them back

SQLMenace