只是尝试使用权限,我想向用户授予CREATE
表权限,但不授予ALTER
或DROP
。此外,用户应该只能创建表(没有存储过程,没有功能)
grant alter on schema::dbo to demo_db_user
grant create table to demo_db_user
通过使用上述命令,用户也可以改变表格。
答案 0 :(得分:0)
如果当前用户不是特定角色(或其他)的成员,你可以写一个DDL-Trigger并阻止ALTER TABLE
,类似这样(未经测试):
CREATE TRIGGER [ddl_tr_prvent_alter_table] ON DATABASE
FOR alter_procedure
as
begin
if User_Name() <> 'dbo'
RAISERROR ('go ahead, you must not change a table', 16, 1);
end