How can I find login name in SQL Server from a user_name
of database using a stored procedure?
Advertisement
Answer
For example you can use the system functions
declare @uname sysname = 'dbo'; -- user name in question SELECT suser_sname(user_sid(USER_ID(@uname))) as login