Define what the user called my stored procedure

I am sure this has been asked, but the search does not return a response.

In a stored procedure, how do I get the value of the user / login that called the stored procedure (name?) If I don't already have server_user_id

+3
source share
1 answer

in sql 2005

select suser_name ()

http://msdn.microsoft.com/en-us/library/ms187934.aspx

SUSER_NAME ([server_user_id]) server_user_id

. server_user_id, , - int. server_user_id SQL Server Microsoft Windows, SQL Server. server_user_id , .

-

edit: Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64)

sql-

:

select suser_name()

select suser_sname()

select original_login()

select system_user

... , ...

Saludos

SAS

+1

Source: https://habr.com/ru/post/1738991/


All Articles