We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Alex Friedman • 5 years ago

Thanks for the heads up, I never liked code using the old sys.syslogins and now there's a good reason to avoid it.
BTW the post has a few "sys.logins" instead of "sys.syslogins" which were a bit confusing, but no biggie.

Taryn • 5 years ago

Thanks for pointing out that error. Fix is incoming.

Rob Volk • 5 years ago

Would this work as a replacement query?

select l.sid sid_varbinary
, l.name
, l.default_database_name
, l.password_hash pwd_varbinary
, CASE WHEN l.is_policy_checked=0 THEN 'OFF' ELSE 'ON' END is_policy_checked
, CASE WHEN l.is_expiration_checked=0 THEN 'OFF' ELSE 'ON' END is_expiration_checked
from sys.server_permissions sp
inner join sys.sql_logins l on sp.grantee_principal_id=l.principal_id
inner join sys.server_principals p on l.principal_id=p.principal_id and p.type='S'
where l.is_disabled=0
and sp.state_desc<>'DENY'
and sp.class_desc='SERVER'
and sp.permission_name='CONNECT SQL'
order by p.name

It avoids using legacy system views.

Taryn • 5 years ago

Yes, it looks like that might work. I'll do a little testing for it to be sure. Thanks for the code!