Windows Authentication USER_NAME ()

When I entered the sql management studio with windows authentication and I ran

SELECT USER_NAME()

I see the result as dbo.

I thought it would show my user ....

I look more at the explanation why it returns dbo

+3
source share
3 answers

Use this instead

SELECT SUSER_NAME()

USER_NAME : returns the database username from the specified identification number.

SUSER_NAME : returns the username for the login.

+7
source

Try:

SELECT SUSER_SNAME ()

+3
source

, , .

→ → . , "Public" no "sysadmin"

+2
source

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


All Articles