loading...

List users in SQL Server database

jsgurugit profile image jsguru ・1 min read

The image below shows how. (on Microsoft SQL Server Management Studio).

List users in sql server database on SSMS

Query

use [database_name]
select name as username,
       create_date,
       modify_date,
       type_desc as type,
       authentication_type_desc as authentication_type
from sys.database_principals
where type not in ('A', 'G', 'R', 'X')
      and sid is not null
      and name != 'guest'
order by username;

Discussion

pic
Editor guide