次の方法で共有


Grant Method (StoredProcedure, UserDefinedFunction)

この機能は、将来のバージョンの Microsoft SQL Server では削除される予定です。新規の開発作業ではこの機能を使用しないようにし、現在この機能を使用しているアプリケーションは修正することを検討してください。

The Grant method assigns a stored procedure permission or a list of permissions to one or more Microsoft SQL Server users or roles.

構文

object
.Grant(
Privilege
,
GranteeNames
, [ GrantGrant ] , [ AsRole ] )

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • Privilege
    Long integer that specifies one or more stored procedure permissions as described in Settings.
  • GranteeNames
    SQL Distributed Management Objects (SQL-DMO) multistring listing users or roles.
  • GrantGrant
    When TRUE, the grantee(s) specified are granted the ability to execute the GRANT statement referencing the stored procedure. When FALSE (default), the ability to extend permission is not granted.
  • AsRole
    String that identifies a role to which the connected user belongs as described in Remarks.

Prototype (C/C++)

HRESULT Grant(
SQLDMO_PRIVILEGE_TYPE iPrivileges,
SQLDMO_LPCSTR GranteeNames,
BOOL GrantGrant = FALSE,
SQLDMO_LPCSTR AsRole = NULL);

Settings

Set Privilege using these SQLDMO_PRIVILEGE_TYPE values.

Constant Value Description

SQLDMOPriv_AllObjectPrivs

63

Grant all applicable object permissions.

SQLDMOPriv_Execute

16

Grant the execute permission on the referenced stored procedure.

解説

When a user is a member of more than a single role, the user can have permission to grant access to a stored procedure under one role and not under another. In this case, SQL Server security mechanisms prevent execution of the Grant method on the StoredProcedure object that references that stored procedure. Use the AsRole argument to specify the role under which permission to execute the grant exists.

ms141801.note(ja-jp,SQL.90).gifメモ :
Granting permissions to database users and roles using the Grant method of the StoredProcedure object requires appropriate permissions. The SQL Server login used for SQLServer object connection must be granted the ability to execute GRANT that references the stored procedure, the owner of the stored procedure, or a member of a role with greater permissions.

For more information about setting multistring parameters, see Using SQL-DMO Multistrings.

Applies To:

StoredProcedure Object

UserDefinedFunction Object