--赋予Jack用户对表student的SELECT,UPDATE,DELETE权限 GRANTSELECT,UPDATE,DELETEONTABLE student TO Jack
--收回Jack SELECT 权限 REVOKESELECTFROM Jack
--拒绝Jack 的SELECT 权限 DENY SELECTTO Jack
1 2 3 4 5 6 7 8 9 10 11 12 13
create login test with password='test',default_database=JIAOGUAN --此登录账户默认拥有数据库JIAOGUAN的权限
use JIAOGUAN createuser test for login test with default_schema=dbo --dbo为DataBaseOwner的简写,每个数据库都有一个dbo用户 exec sp_addrolemember 'db_owner', 'test'--将test加入 db_owner角色
use JIAOGUAN deny inserton Student to test --拒绝test用户对Student表执行insert
use JIAOGUAN deny selecton Student(gender,birth) to test --拒绝test用户访问Student表的gender和birth字段