SQL语法错误创建角色

时间:2015-10-13 23:22:25

标签: sql sql-server

尝试向用户授予特定角色时不断收到错误:

Grant role role_1 to maintenance;

错误:

  

#role_1'

附近的语法不正确

想要对其进行编辑,以便授予用户使用授权角色

1 个答案:

答案 0 :(得分:0)

GRANT {role_name} TO {user_name};

对于T-SQL,这是GRANT

的简化语法
GRANT { ALL [ PRIVILEGES ] }
      | permission [ ( column [ ,...n ] ) ] [ ,...n ]
      [ ON [ class :: ] securable ] TO principal [ ,...n ] 
      [ WITH GRANT OPTION ] [ AS principal ]

在您的情况下,只需

GRANT role_1 TO maintenance;