Determine the last change of the sa password?
Let us face it, when did you last change the sa password?
You can check last change in SQL Server 2005, for the sa login by using LOGINPROPERTY
function.
Execute the following T-SQL code:
SELECT LOGINPROPERTY ('sa', 'PasswordLastSetTime')
And a little bit more...
DECLARE @name nchar(100)
SET @name ='sa'
SELECT
LOGINPROPERTY( @name, 'PasswordLastSetTime' )
AS PasswordLastSetTime,
LOGINPROPERTY( @name, 'IsExpired' )
AS IsExpiried,
LOGINPROPERTY( @name, 'IsLocked' )
AS IsLocked,
LOGINPROPERTY( @name, 'IsMustChange' )
AS IsMustChange,
LOGINPROPERTY( @name, 'LockoutTime' )
AS LockoutTime,
LOGINPROPERTY( @name, 'BadPasswordCount' )
AS BadPasswordCount,
LOGINPROPERTY( @name, 'BadPasswordTime' )
AS BadPasswordTime,
LOGINPROPERTY( @name, 'HistoryLength' )
AS HistoryLength,
LOGINPROPERTY( @name, 'PasswordHash' )
AS PasswordHash
GO
LOGINPROPERTY comes in useful for several other bits of information about login policy settings in SQL Server 2005:
- Check if login is locked,expired
- Check if password must be changed
- Check bad password attempts, and time since last bad attempt
- Check the length of time the login has been password-policy enforced
- Check lockout time
- ...
And now what about Microsoft SQL Server 2008 / R2 are there any changes?
Yes, indeed!
We get LOGINPROPERTY with three new arguments:
- DaysUntilExpiration
- DefaultDatabase
- DefaultLanguage
DECLARE @name nchar(100)
SET @name ='sa'
SELECT
LOGINPROPERTY( @name, 'PasswordLastSetTime' )
AS PasswordLastSetTime,
LOGINPROPERTY (@name, 'DaysUntilExpiration' )
AS DaysUntilExpiration,
LOGINPROPERTY (@name, 'DefaultDatabase' )
AS DefaultDatabase,
LOGINPROPERTY (@name, 'DefaultLanguage' )
AS DefaultLanguage
GO
So, give LOGINPROPERTY a chance!
Print article | This entry was posted by tosc on 2008-04-04 at 13:15:20 . Follow any responses to this post through RSS 2.0. |
Tag cloud
administration backup «best practices» books bug ctp «cumulative update» datetime demo dmv ebook humor index indexoptimize integrity kbfix links maintenance «ms sql server 2008» performance php «reporting services» reviews rtm serverproperty «service pack» «service pack 2» «service pack 3» «service packs» sharepoint sp_msforeachdb «sql server» «sql server 2005» «sql server 2008 r2» «sql server 2012» «sql server 2014» «sql server builds» sqlcat sqlpass «sqlpass franken» ssms ssmstoolspack «stacia misner» «system views» t-sql «technical note» tempdb tools version whitepapers