SQL Tips by Namwar Rizvi

June 12, 2007

Retrieve current user permissions in SQL Server 2005

If you want to retrieve the permissions available for the currently logged in user then you can use the function called fn_my_permissions in SQL Server 2005. Following are examples of its usage:

Use AdventureWorks
Go

—Return Caller’s permission on the current server
SELECT * FROM fn_my_permissions(NULL, ‘SERVER’);
Go

—Return Caller’s permission on the current database
SELECT * FROM fn_my_permissions(NULL, ‘DATABASE’);
Go

—Return Caller’s permission on the given object
SELECT * FROM fn_my_permissions(‘Sales.vIndividualCustomer’, ‘OBJECT’);
Go

For further details please refer to Technet help here

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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

Create a free website or blog at WordPress.com.

%d bloggers like this: