views:

17

answers:

2

Is there a way in sql server 2005 to query for enabled and disabled accounts? basically I wanted to see the current state of user accounts. I mean the accounts affected by command below. ALTER LOGIN someuser ENABLED|DISABLE

+1  A: 

select * from sys.sql_logins gives you the information you're after. Take a look @ the is_disabled column.

Will A
...edited to move from old-style to new-style catalog tables. `sys.server_principals` may be more appropriate if you want NT logins included as well.
Will A
A: 

You're "not supposed" to query the sys tables directly. sp_helpuser, sp_MShasdbaccess can be used as an alternative.

Conrad Frix
Really? I thought that was what they were there for. Well, that, and supporting MSSQL in it's day-to-day running of course. :)
Will A
http://msdn.microsoft.com/en-us/library/ms179932.aspx
Conrad Frix