How to query a database users and their roles

Run this query:

select a.uid, a.name, b.groupuid, case when c.name is null then 'public' else c.name end as db_role from sysusers a left outer join sysmembers b on a.uid=b.memberuid left outer join sysusers c on b.groupuid=c.uidwhere a.status>0

sp_change_users_login

After you restore a database from a different instance, you may receive login errors when trying to access the restored database. To resolve this, run sp_change_users_login to check for orphaned users. for example:

> sp_change_users_login 'report'

if there are orphaned users listed, run either one of this to resolve:

> sp_change_users 'auto_fix', 'user'

> sp_change_users 'update_one', 'user', 'login'

refer to BOL for more information about this stored procedure.

.

sp_helpdb @dbname=N''tempdb'' tempdb Arithmetic overflow error converting expression to data type int

If you get the following error from tempdb database:

sp_helpdb @dbname=N''tempdb'' tempdb Arithmetic overflow error converting expression to data type int

The solution is to set max size (using ALTER DATABASE command because tempdb properties is inaccessible)

.

returned false Error: Action "ParseBootstrapOptionsAction" failed during execution

I had a failed SQL Server 2005 installation with the following error (not the complete error messages):

......
Complete: ParseBootstrapOptionsAction at: 2008/9/29 2:55:52, returned false
Error: Action "ParseBootstrapOptionsAction" failed during execution. Error information reported during run:
Could not parse command line due to datastore exception.
Source File Name: utillib\persisthelpers.cpp
Compiler Timestamp: Fri Jul 29 01:13:55 2005
Function Name: writeEncryptedString
Source Line Number: 124
----------------------------------------------------------
writeEncryptedString() failed
Source File Name: utillib\persisthelpers.cpp
Compiler Timestamp: Fri Jul 29 01:13:55 2005
Function Name: writeEncryptedString
Source Line Number: 123
----------------------------------------------------------
.......


Called MS Support and she asked me to check and compare the following registry keys:
1) HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
2) HKEY_USERS\S-1-5-18\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

I found that only Local AppData entry was there, others were missing. Then I added each value to the first key by referring to the values in the second key.

Then I restarted installation again, successful!!

.