Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
safderalimd
Starting Member
32 Posts |
Posted - 2010-05-11 : 14:11:53
|
| Is it possible to capture application user in delete trigger?We are trying to use sql server delete trigger to audit physical deletes issued from java application. My problem is how can I capture applicaiton deleted by user in sql trigger??? |
|
|
malpashaa
Constraint Violating Yak Guru
264 Posts |
Posted - 2010-05-11 : 14:31:19
|
If you want the user name then use: SELECT USER_NAME() But if you want login name then use: SELECT SUSER_NAME() |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2010-05-11 : 14:44:33
|
| If the application is using application security, then it isn't possible to capture the info from the trigger. From SQL Server, we can only see the user name or login name that is being used for the SQL connection. You would need to include the application user in the data in order to see it in the trigger.But this only applies if you are using application security. Are the application users just a row in a table or are they actually distinct SQL users?Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
safderalimd
Starting Member
32 Posts |
Posted - 2010-05-11 : 15:02:36
|
| Application users are just a row in a table and application uses common sql login for all connections. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
safderalimd
Starting Member
32 Posts |
Posted - 2010-05-12 : 08:57:34
|
| Thaks for your response.I guess there are lot of professionals like me who had same issue and I wonder how they are handling it? SQL server has come long way and I hope they will solve this issue by providing some sort of attributes to SQL threads coming in from external applications. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|