Đỉnh NGUYỄN

life's a journey not a destination

Xem quyền tất cả người dùng trên các đối tượng trong T-SQL

Leave a comment


Dựa vào system database schema

SELECT  sysU.name ,
        sysO.name ,
        permission_name ,
        granted_by = SUSER_NAME(grantor_principal_id)
FROM    sys.database_permissions
        JOIN sys.sysusers sysU ON grantee_principal_id = uid
        JOIN sys.sysobjects sysO ON major_id = id
ORDER BY sysU.name

Kết quả:

image

Nếu bạn biết cách nào tốt hơn, tôi rất muốn biết!

Advertisements

Author: dinhnn

Senior software developer, a technical leader. You can be reached at via email to dinhnguyenngoc@gmail.com, via my blog at dinhnguyenngoc.wordpress.com, and on Twitter @dinhnguyenngoc.

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s