DEV Community

jsguru
jsguru

Posted on

List users in SQL Server database

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;

Top comments (0)