开发者

SQL Server: Let user create/modify new views, but not alter existing

开发者 https://www.devze.com 2023-03-07 03:17 出处:网络
We would like to let users create their own custom views but don\'t want to let them modify any existing tables or views.I am pretty green regarding the administration capabilities of SQL Server, but

We would like to let users create their own custom views but don't want to let them modify any existing tables or views. I am pretty green regarding the administration capabilities of SQL Server, but I assume this is a common scenario.

I was thinking the best route to do this would be to create a new schema to contain these views, and then开发者_JS百科 only let the user have control over this schema. Is this reasonable?

The issue is I don't actually know the mechanics to do this. I created the schema, and I tried to create a role for this schema, but its not 'clicking' in my mind.


I'm not sure what version of SQL Server you're using? But in 2008, Open SQL Server Management Studio. Create a new procedure, and add this code:

GRANT CREATE VIEW ON SCHEMA :: your_schema TO user_role

I think that should work...? I only use SQL Server now and then. You might have to give them ALTER, SELECT, etc. as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消