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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-07-28 : 07:15:53
|
| Everardo writes "Hello,I wonder if it is possible to get the windows login of the userlogged on a given machine even though he logged onto sql server using a generic sql login. Example:my windows login is ecunha but i log onto sql using corieditor.how can i get ecunha from inside a stored procedure?thank you,everardo" |
|
|
Andraax
Aged Yak Warrior
790 Posts |
Posted - 2003-07-28 : 07:18:35
|
| You can't do that in any easy way I'm afraid. |
 |
|
|
smccreadie
Aged Yak Warrior
505 Posts |
Posted - 2003-07-28 : 07:45:29
|
| A couple of options:1. Switch to Windows authentication on SQL and capture it that way2. Pass it into your queries using parameters |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-07-28 : 07:58:50
|
| Take a look at the HOST_NAME() function in Books Online. It actually returns the machine name of the connected computer, but in many networks this is the same or similar to the login of the user (the regular user, anyway). |
 |
|
|
Andraax
Aged Yak Warrior
790 Posts |
Posted - 2003-07-28 : 08:12:49
|
| It's natural that there is no way to get the windows user name if the user logged in with SQL Security, because the user might not connect from a windows machine at all. It might be a Linux machine or an IBM mainframe for all you know.The only good option is to use Integrated security. |
 |
|
|
|
|
|