Search This Blog

How can I get all the user id's, NT Auth and SQL Auth used on a server by database

How can I get all the user id's, NT Auth and SQL Auth used on a server by database

exec sp_MSforeachDB 'use ? ;
IF EXISTS(SELECT 1 FROM sysusers su INNER JOIN master..syslogins sl ON sl.sid = su.sid WHERE sl.isNtName = 1 )
SELECT ''?'' DB,sl.Name FROM sysusers su
INNER JOIN master..syslogins sl on sl.sid = su.sid
WHERE sl.isNtName = 1 '




Original Post :
http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_21917220.html

No comments: