Click here to Skip to main content
15,910,981 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to keep the log detail for my record
in MS SQL Database when user Delete a record.
So I have a SQL Trigger Delete Function in related Table.
What I want to keep is the User Name From My Software's User
who delete the record, But i have no any field keep in the table,
Is that MS SQL have any session variable or temp variable that
can let my system to update and run at once together with Trigger Delete and
so keep in the log detail table ?
Posted
Updated 14-Sep-13 22:51pm
v3

1 solution

You can get the current user by using

SQL
SELECT SUSER_NAME();


Which will give you the current user in a Domain\User Name format.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900