Sladescross's Blog

Blogging about Sharepoint related stuff

SQL Tip – User Privileges May 16, 2012

Filed under: db_owner,SQL Tip — sladescross @ 4:58 pm

sys.logintoken; sys.usertoken

check these when using EXECUTE AS

SELECT suser_sname(owner_sid) as owner,name from sys.databases where name like ‘%_DB’ Or name like ‘%content%’

SELECT     USER_NAME(memberuid), USER_NAME(groupuid) FROM     sys.sysmembers WHERE     USER_NAME(groupuid) IN (‘db_owner’, ‘db_accessadmin’)

SELECT USER_NAME(u.uid) as UID, u.sid from sys.sysusers u

SELECT USER_NAME(u.uid) as UID, u.sid, l.* from sys.sysusers u inner join master.sys.syslogins l on u.sid=l.sid

About these ads
 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 63 other followers