How to determine if database login is disabled without using a graphical interface in the selected query

I searched for an answer in the last 30 minutes on Google, but could not find a satisfactory answer.

I can get a list of db logins from the syslogins table, but it does not contain a field indicating whether the input is disabled. I need to use this in the selected query. Can anyone enlighten me?

Note that this applies to SQL Server 2000.

+7
source share
5 answers
select name, hasaccess from sys.syslogins 

I believe the hasaccess field is what you are looking for. According to MSDN , hasaccess is 1 if the login has access to the instance, and 0 if not.

+9
source

Connection Reduction:

select the name, is_disabled from sys.sql_logins where is_disabled = 1 order for 1

+4
source

use sys.sql_logins to check on / off login status. Example

 select * from syslogins sl join sys.sql_logins sql on sl.sid=sql.sid where is_disabled=1 
+2
source
 SELECT is_disabled,* FROM sys.sql_logins 
+2
source

The accepted answer is incorrect because it does not provide useful information. If the account is disabled, the hasaccess column can still be 1 .

Closest correct:

 select name,is_disabled,* from sys.sql_logins where name = '' , if its an SQL account. 
0
source

Source: https://habr.com/ru/post/1381040/