Home > SQL Server, T-SQL > Evaluating permission on a securable using HAS_PERMS_BY_NAME – SQL Server

Evaluating permission on a securable using HAS_PERMS_BY_NAME – SQL Server


HAS_PERMS_BY_NAME(): This function is used to evaluate the permission of the current user on a securable. It returns an integer value 1 or 0 or null. Value 1 represents true and value 0 represents false and null represents invalid function arguments.

Function Syntax

HAS_PERMS_BY_NAME ( securable , securable_class , permission
[ , sub-securable ] [ , sub-securable_class ] )

Function Arguments

securable:  It is the name of the securable of type sysname. We can also use null if we get the permission for server.

securable_class: It is the name of the class of securable of type nvarchar(60). Please refer the SecurableAndPermission PDF document.

permission: It is the name of the permission to be evaluated. Please refer the SecurableAndPermission PDF document.

Download SecurableAndPermission PDF Document

Optional Arguments

sub-securable: it is the name of the securable sub-entity. For instance, table column name

sub-securable_class: It is the class of securable sub-entity. For instance ‘COLUMN’

Example

1. Retrieving the column names and its select permission for the current user.

pic1

In this blog post I have given the basic information to use this function. So, Please refer the MSDN for more details.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

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

%d bloggers like this: