views:

21

answers:

1

How can I find out and set if an User is enabled or disabled using SQL commands? Same problem for windows policy enabled/disabled for an User.

+1  A: 

You can use LOGINPROPERTY - example -

SELECT LOGINPROPERTY('John3', 'IsLocked');
GO

You can use sys.server_principals for checking enabled disabled -

SELECT * from sys.server_principals where "name" = 'loginname'
Sachin Shanbhag