| Author |
Topic  |
|
|
kok_sheng2000
Starting Member
10 Posts |
Posted - 05/15/2012 : 00:20:18
|
Hi, Everyone.
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 ? |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47069 Posts |
Posted - 05/15/2012 : 00:44:16
|
make use of SUSER_SNAME() function to get username
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
kok_sheng2000
Starting Member
10 Posts |
Posted - 05/15/2012 : 00:51:10
|
Hi, visakh16, Thanks For Reply . I want the user name from my software login user name not the MS SQL Login User name. I Means a variable user name send from my program during Delete Operation. Tq |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47069 Posts |
Posted - 05/15/2012 : 01:13:28
|
quote: Originally posted by kok_sheng2000
Hi, visakh16, Thanks For Reply . I want the user name from my software login user name not the MS SQL Login User name. I Means a variable user name send from my program during Delete Operation. Tq
do you've a table storing those usernames in sql server? or is it domain username?
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
kok_sheng2000
Starting Member
10 Posts |
Posted - 05/15/2012 : 01:21:25
|
My Program Current Login Username, I have keep it Database, But The problem is :- 1> There are multi-user login at a time. 2> During Trigger Delete, username that delete not send to trigger. So, What i want to know is, how or any other way to Send / communicate with Trigger Delete when a user delete a record. Thank in advanced ... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47069 Posts |
Posted - 05/15/2012 : 22:09:18
|
quote: Originally posted by kok_sheng2000
My Program Current Login Username, I have keep it Database, But The problem is :- 1> There are multi-user login at a time. 2> During Trigger Delete, username that delete not send to trigger. So, What i want to know is, how or any other way to Send / communicate with Trigger Delete when a user delete a record. Thank in advanced ...
you've capture and send that information manually unless its not a domain or standard sql user
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
kok_sheng2000
Starting Member
10 Posts |
Posted - 05/16/2012 : 21:46:24
|
| Oop, is like that , then no choice ... Thanks for help me ... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47069 Posts |
Posted - 05/16/2012 : 21:49:42
|
np
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
| |
Topic  |
|