GRANT命令的一般语法如下所示: GRANTpermission_typeONobject_nameTOuser_or_role; 1. permission_type是你想要授予的权限类型,例如SELECT、INSERT、UPDATE、DELETE等。 object_name是你要授予权限的对象,可以是表、视图、存储过程等。 user_or_role是你要授予权限的用户或角色。 2. 示例 2.1 授予 SELECT 权限 假设...
GRANTpermission [ ,...n ]ON{ [USER::database_user] | [ROLE::database_role] | [APPLICATIONROLE::application_role] }TO<database_principal>[ ,...n ] [WITHGRANTOPTION] [AS<database_principal>]<database_principal>::=Database_user|Database_role|Application_role|Database_user_mapped_...
ALL PRIVILEGES- as we saw previously, this would allow a MySQL user all access to a designated database (or if no database is selected, across the system) CREATE- allows them to create new tables or databases DROP- allows them to them to delete tables or databases DELETE- allows them to...
GRANT<permission>[ ,...n ]TO<database_principal>[ ,...n ] [WITHGRANTOPTION] [AS<database_principal>]<permission>::=permission |ALL[PRIVILEGES]<database_principal>::=Database_user|Database_role|Application_role|Database_user_mapped_to_Windows_User |Database_user_mapped_to_Windows_Group ...
So what about a named user? Let's create a login and check to see what permissions are added specifically because of the login: CREATE LOGIN TestLoginPerms WITH PASSWORD = '!S0meStr0ngP4ssw0rd!'; GO SELECT sp.state_desc, sp.permission_name, sp.class_desc, sp.major_id, sp.minor_id...
If you want to grant access to only user “User1” of the database you can do the following: USEAdventureWorks GOGRANTVIEWDefinitionTOUser1 Copy To turn off this functionality you would issue theREVOKEcommand such as one of the following: ...
GRANT SELECT, INSERT, UPDATE ON [YourTable] TO [NewRole]:向NewRole角色授予读取、插入和更新YourTable表的权限。 4. 将用户添加到角色 将用户添加到你创建的角色,以便让用户获得该角色的权限。代码如下: EXECsp_addrolemember'NewRole','NewUser'-- 将新用户添加到新角色GO ...
GRANT permission [ ,...n ] TO <grantee_principal> [ ,...n ] [ WITH GRANT OPTION ] [ AS <grantor_principal> ] <grantee_principal> ::= SQL_Server_login | SQL_Server_login_mapped_to_Windows_login | SQL_Server_login_mapped_to_Windows_group | SQL_Server_login_mapped_to_certificate |...
GRANTpermission [ ,...n ]ONTYPE:: [schema_name. ]type_nameTO<database_principal>[ ,...n ] [WITHGRANTOPTION] [AS<database_principal>]<database_principal>::=Database_user|Database_role|Application_role|Database_user_mapped_to_Windows_User |Database_user_mapped_to_Windows_Group |Databas...
GRANT permission [ ,...n ] ON { [ USER :: database_user ] | [ ROLE :: database_role ] | [ APPLICATION ROLE :: application_role ] } TO <database_principal> [ ,...n ] [ WITH GRANT OPTION ] [ AS <database_principal> ] <database_principal> ::= Database_user | Database_...