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