Find Login in SQL Server

Are there any queries in SQL Server that return all login accounts and information about them? On SQL Server there is a virtual catalog table (a VIEW, or system table) called sys.sql_logins. You can run the above query and the results will return all Login created in SQL Server with information about them.

To retrieve all login accounts in SQL Server, run the following command.

 SELECT  * 
Ma ster.sys.sql_logins FROM ma ;

VIEW sys.sql_logins includes the columns below

Column Explanation of ten This is ten_dangnhap specified in the CREATE LOGIN command id_uynhem Number value giatri_duynhat The unique value specified in the CREATE LOGIN command type

Proxy type:

  1. S = SQL Server user
  2. U = Windows users
  3. G = Windows group
  4. A = application rights
  5. R = database permissions
  6. C = authentication is mapped
  7. K = asymmetric key is mapped
type_desc

Description for proxy types:

  1. SQL_USER
  2. WINDOWS_USER
  3. WINDOWS_GROUP
  4. APPLICATION_ROLE
  5. DATABASE_ROLE
  6. CERTIFICATE_MAPPED_USER
  7. ASSYMETRIC_KEY_MAPPED_USER
vohieu 0 or 1 immediately o Date / time to create a Login with the CREATE LOGIN command at the moment of the last Login date / time with the command ALTER LOGIN ten_cosodulieu_macdinh This is the default database in the CREATE LOGIN or ALTER LOGIN command. in the CREATE LOGIN or ALTER LOGIN command id_chungthuc This is the certificate used in the CREATE LOGIN or ALTER LOGIN command, 0 or 1, specified in the CREATE LOGIN or ALTER LOGIN command to initiate 0 or 1, specified in the CREATE LOGIN or ALTER command LOGIN makhau_bam Hash value of the password

Compatible in older versions

In older SQL Server versions, you can get all Login information using the SQL Server 2000 system table like sys.syslogins, using the command below.

 SELECT * 
FROM master.s ys.syslogins;

The system table sys.syslogins (SQL Server 2000) contains the following columns.

Column Explanation giatri_duynhat The unique value specified in the CREATE LOGIN page command does not apply immediately The Date / Time created Login with the CREATE LOGIN command immediately snapnhat Last login date / time with the command ALTER LOGIN accdate Not used totcpu No apply totio Not apply spacelimit Not applicable timelimit Not apply resultlimit Not apply ten This is ten_dangnhap specified in the CREATE LOGIN command. tendb The default database is the default language 0 or 1 default 0 or 1 number 0 or 1 number 0 or 1 number 0 or 1 admins 0 or 1 admin or 0 adminset 0 or 1 admin 0 or 1 adminodia 0 or 1 nguoitaodb 0 or 1 adminbulk 0 or 1 tendangnhap This is ten_dangnhap specified in the CREATE LOGIN command.

Previous article: DROP LOGIN command in SQL Server

The following article: CREATE USER command in SQL Server

4.5 ★ | 2 Vote

May be interested

  • New points in SQL Server 2017Photo of New points in SQL Server 2017
    the sql server 2017 version is primarily connected to linux, bringing the power of sql to linux. in short, you can install sql server 2017 on linux, using sql server 2017 on linux-based docker containers. sql server 2017 also allows you to choose development languages, develop it on-premise or cloud-based.
  • The CREATE USER command in SQL ServerPhoto of The CREATE USER command in SQL Server
    this article will show you in detail how to use the create user command in sql server, with specific syntax and examples to better visualize and capture commands.
  • Instructions for installing SQL Server 2017 step by stepPhoto of Instructions for installing SQL Server 2017 step by step
    sql server 2017 comes with new features in the installation process. it now supports the machine learning service for r and python. it also includes ssis scale out master and scale out worker.
  • DROP USER command in SQL ServerPhoto of DROP USER command in SQL Server
    this article will show you in detail how to use the drop user command in sql server with specific syntax and examples to better visualize and capture commands.
  • Find User in SQL ServerPhoto of Find User in SQL Server
    do any queries on sql server return all user created?
  • Use annotations in SQL ServerPhoto of Use annotations in SQL Server
    this article will show you how to use annotations in sql server statements.