Determine what user called my stored procedure
I'm sure this has been asked, but search isn't returning the answer.
In a stored procedure, how do I get the value of the user/login that called the stored procedure (name?), assuming I don't already have server_user_id
in sql 2005
SUSER_NAME ( [ server_user_id ] ) server_user_id
Is the login identification number of the user. server_user_id, which is optional, is int. server_user_id can be the login identification number of any SQL Server login or Microsoft Windows user or group that has permission to connect to an instance of SQL Server. If server_user_id is not specified, the login identification name for the current user is returned.
edit: just tried it with Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64)
with integrated and sql security
and all these:
correctly return the logged user... I guess there's some problem with your configuration...