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
backup «best practices» books bug configuration ctp «cumulative update» demo denali dmv ebook humor index indexoptimize integrity kbfix loginproperty maintenance «ms sql server 2008» performance php profiler «reporting services» reviews «service pack» «service pack 2» «service packs» sharepoint «sql 2012» «sql pass» «sql server» «sql server 2005» «sql server 2008 r2» «sql server 2012» «sql server 2014» sqlcat sqlpass «sqlpass franken» ssms ssmstoolspack sysadmin «system views» t-sql «technical note» tempdb tools «trace flag» troubleshooting upgrade whitepapers