Orphan SQL-Server accounts
By using SP_MSForEachDB you can detect and display orphan SQL-Server accounts from all the databases of your SQL-Server.
EXEC SP_MSForEachDB 'USE [?];
-- SYSTEM DATABASE ARE EXCLUDED
IF DB_ID(''?'') > 4
SELECT ''?'' as DBName,
name AS UserName,
sid AS UserSID
FROM .sysusers
WHERE issqluser = 1 AND
(
sid IS NOT NULL AND sid <> 0x0
)
AND suser_sname(sid) IS NULL
ORDER BY name'
CU tosc
Print article | This entry was posted by tosc on 2008-04-18 at 14:20:05 . 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» pass 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 «system views» t-sql «technical note» tempdb tools version whitepapers