开发者

SQL USER_NAME() windows authentication

开发者 https://www.devze.com 2023-01-18 03:01 出处:网络
When I logged in sql management studio with windows authentication and I run SELECT USER_NAME() I see the result as dbo.

When I logged in sql management studio with windows authentication and I run

SELECT USER_NAME()

I see the result as dbo.

I would of thought that it would showed my user ....

I more looking开发者_如何学JAVA at the explaination to as why it returns dbo


Use this instead

SELECT SUSER_NAME()

USER_NAME: Returns a database user name from a specified identification number.

SUSER_NAME: Returns the login identification name of the user.


Try:

SELECT SUSER_SNAME()


i had similar problem, the problem is due to the way user id is created.

choose the login id under security -> right click properties -> Server Roles. Ensure you click only "Public" no "sysadmin"

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号