Home Forums SQL Server 2008 Security (SS2K8) ALTER LOGIN for all SQL account with "Enforce password expiration" turned on RE: ALTER LOGIN for all SQL account with "Enforce password expiration" turned on

  • DECLARE @sSQL NVarchar(4000) = ''

    SELECT @sSQL = @sSQL + 'ALTER LOGIN ' + '[' + name + '] ' + ' WITH CHECK_EXPIRATION = OFF; '

    FROM sys.sql_logins

    WHERE is_policy_checked = 1

    AND is_expiration_checked = 1;

    EXEC (@sSQL)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass