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 |
|
Ex
Posting Yak Master
166 Posts |
Posted - 2005-01-17 : 00:41:02
|
| hey all,i was wondering if it is possiblei have application with sql server as the backend databasethe application logs in with 1 user name and passwordbut i was wondering in some of my tables i want to capture the windows login name of the person using the applicationis there a way to do this in sql serverfor example the keyword USER will give you the login name of the account you loged in on i.e sa gives the name dbois there another function or way to get the windows login of the person using the database? |
|
|
Hippi
Yak Posting Veteran
63 Posts |
Posted - 2005-01-17 : 01:03:01
|
quote: Originally posted by Ex hey all,i was wondering if it is possiblei have application with sql server as the backend databasethe application logs in with 1 user name and passwordbut i was wondering in some of my tables i want to capture the windows login name of the person using the applicationis there a way to do this in sql serverfor example the keyword USER will give you the login name of the account you loged in on i.e sa gives the name dbois there another function or way to get the windows login of the person using the database?
How about Select SUSER_SNAME() |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2005-01-17 : 01:17:18
|
| select user--------------------keeping it simple... |
 |
|
|
Ex
Posting Yak Master
166 Posts |
Posted - 2005-01-17 : 19:23:10
|
| ok sorry might not have been specific enoughSUSER_SNAME() returns the login nameUSER returns the name for the login name i.e sa is refered to as dbowhat i wanted to get was the windows NT login nameis this possible to get? |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2005-01-18 : 01:45:54
|
| select nt_username from master..sysprocesseswhere spid=@@spid--------------------keeping it simple... |
 |
|
|
|
|
|