LOGINPROPERTY

statements
#tsql#statements

Syntax

LOGINPROPERTY ( 'login_name' , 'property_name' )

Return Type

sql_variant

Property Descriptions

PropertyReturn TypeDescription
BadPasswordCountintNumber of consecutive failed login attempts.
BadPasswordTimedatetimeTime of the last failed login attempt.
DaysUntilExpirationintNumber of days until the password expires.
DefaultDatabasenvarcharDefault database for the login.
DefaultLanguagenvarcharDefault language for the login.
HistoryLengthintNumber of password changes tracked.
IsExpiredintIndicates if the password is expired.
IsLockedintIndicates if the login is locked.
LockoutTimedatetimeTime when the login was locked out.
PasswordHashvarbinaryHash of the password.
PasswordLastSetTimedatetimeTime when the password was last set.
PrincipalIDintID of the principal.
SIDvarbinarySecurity identifier of the login.

Remarks

Returns information about login policy settings.

Example

SELECT LOGINPROPERTY('database_name', 'BadPasswordCount') AS BadPasswordCount;