sql - Getting the name of the user who executed the Stored Procedure -
i know can done in code (c#) using windowsidentity
, there way within sp itself?
i tried using user
function it's returning dbo instead of name. because user owner of database? if that's so, how can db owner's login name?
edit:
the application executes sp uses sa user account, if use system_user
, returned value sa.
select system_user
will return name of user excecute code in sql. more in aricle
if sql server service work sa there no way (windows) username sql server side. suppose security issue. information connection sql server may table sys.dm_exec_connections
. there stored ip addreses , port s , other useful things existings connections.
Comments
Post a Comment