SQL Azure: list all logins and users

前端 未结 2 1257
挽巷
挽巷 2020-12-31 11:36

I\'m using V12 Azure SQL.

To list all logins (server level) we can use this query on master database:

SELECT *         


        
相关标签:
2条回答
  • 2020-12-31 12:29

    To find the login mapped for a user, look at the sid column from sys.sysusers.

    This value corresponds to the sid column from sys.sql_logins in the master database.

    Unfortunately, you cannot discover the login name for the SID while connected to the user database. You must connect separately to the master database once you have the sid and query sys.sql_logins to get the name.

    0 讨论(0)
  • 2020-12-31 12:38

    When connected to the master DB you can run this query to make a list of the Logins and the Users

    select l.name as [login name],u.name as [user name] from sysusers u inner join sys.sql_logins l on u.sid=l.sid
    

    I hope this may work

    0 讨论(0)
提交回复
热议问题