You can directly download the script from here: http://www.sqlservercentral.com/Forums/Attachment3502.aspx
Provided the link so that folks who are having Misc' characters issue can get this file and use it.
Description: This script generates a list of Usernames and the database Roles that the user belongs to in all the databases; with a couple of other useful information detailed below.
Other benefit: you can use this script to get the roles of ONE specific user in all the databases.
Directions of Use:
For All Users list: You can directly run this script in SQL Server Management studio
For a specific user:
1. Find this code /*and u.name like ''tester''*/
2. Uncomment the code
3. Replace the Name ''tester'' with the username you want to search on.
ServerName: Name of the server this script was executed on.
DBName: Database name that the user exists in.
Name: user name.
GroupName: Group/Database Role that the user is a part of.
LoginName: Actual login name, if this is null, Name is used to connect.
Tested: This script is tested on SQL Server 2005 standard edition with sp2 and the forum users were generous enough to test the script on SQL server 2000 and SQL Server 2008 and deemed the script working.
08/26/2008 Shiva Challa - Removed the misc characters from the "Select of EXEC sp_MSForEachdb" statement.
09/02/2008 Cathy Greenselder - Convert to SQL2000
- (default_database_name not in SQL2K)
- (default_schema_name not in SQL2K)
- (principal_id not in SQL2K)
- (uid is in SQL2K
10/08/2008 Shiva Challa - Added Cathy's script to the original script with an IF logic to make it work for both SQL 2000 and SQL 2005.
- Added code to use SysObjects in 2000 instead of sys.objects
10/09/2008 Cathy Greenselder - for 2000, switched the SysUsers join to use "m.groupuid" instead of "m.memberuid"
02/09/2009 Shiva Challa - Per Matt Karp's(forum member) suggestion, added Square brackets around dbname,
- changed dbname datatype to sysname instead of varchar(50)
- Added ServerName to the select