Technical Article

get users across all databases on the SQL Server instance

,

THis is undocumented SP in SQL Server still carried over to SQL 2005.

I use [?] to include all databases that include a space between Words etc.

''?'' to include the name of the Database in the select list to easily identify, what users belong to which DB.

sp_msforeachdb @command1='use [?] select ''?'' as dbname, name from sysusers order by name'

Rate

2.5 (4)

Share

Share

Rate

2.5 (4)