1.下面是我写的权限授予和取消的SQL语句,权限授予成功了,怎么取消不了权限呢?
1>新建登录名
create login login1 with password='stu1'
use db_StudentsInfo
create user stu1 for login login1;
create login login2 with password='stu2'
use db_StudentsInfo
create user stu2 for login login2;
create login login3 with password='stu3'
use db_StudentsInfo
create user stu3 for login login3;
2>授权
use db_StudentsInfo
grant select
on SC
to stu2;
grant select
on Student
to stu2;
grant select,update(Ccredit)
on Course
to stu2;
3>取消权限
use db_StudentsInfo
revoke select on SC from Stu1;
use db_StudentsInfo
revoke update,insert on Student from Stu1;
use db_StudentsInfo
revoke delete on Course from Stu1;
我在用stu1用户登录不能撤销权限,windows登录也不能撤销权限
2.下面是将权限授予角色,然后将角色权限授予用户。为什么用grant授予时,用户stu3并没有得到权限,而且还报错。用存储过程写成功了,他们两者有什么区别吗?
use db_StudentsInfo
create role Myrole;
grant select,insert on Student to Myrole;
--grant Myrole to stu3;
exec sp_addrolemember Myrole,stu3;--以stu3登录后使其拥有Myrole权限