HAS_PERMS_BY_NAME#

Evaluates the effective permission of the current user on a securable.

Syntax#

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

Arguments#

securable

Is the name of the securable. If the securable is the server itself, this value should be set to NULL. securable is a scalar expression of type sysname. There is no default.

securable_class

Is the name of the class of securable against which the permission is tested. securable_class is a scalar expression of type nvarchar(60).

permission

A nonnull scalar expression of type nvarchar(60) that represents the permission name to be checked. There is no default. The permission name ANY is a wildcard.

sub-securable

An optional scalar expression of type nvarchar(60) that represents the name of the securable sub-entity against which the permission is tested. The default is NULL.

sub-securable_class

An optional scalar expression of type nvarchar(60) that represent the class of securable subentity against which the permission is tested. The default is NULL.

Return types#

int

Examples#

SELECT HAS_PERMS_BY_NAME(null, null, 'VIEW SERVER STATE');

See Also#