i don't get to play with permissions much, so this post intrigued me;
does db_datareader automatically bring in EXECUTE permissions on views
or db_datawriter automatically bring in EXECUTE permissions on procs/functions?
can someone confirm that the OP requirements for needing CREATE/ALTER EXECUTE on all procs , but denying DDL to tables means you have to resolve this way?
If cannot give db_ddladmin to the role, would you instead loop thru every proc, and grant each individually?
would that allow him to create a proc that does not exist? or is it more correct to do the reverse, grant db_ddladmin , but then loop thru every table and explicitly DENY?
it seems like i'm missing something where i might expect to be able to do something at the "object type" level,
I've seen the GRANT VIEW ANY DEFINITION to allow people to see the DDL of views and procs.
it seems like the granularity is missing bewtween schema and individual objects, or am i missing the command on how todo it?like this:
is there a similar command like GRANT CREATE ANY PROCEDURE, or are you stuck looping thru objects
I looked in BOL, but the actual examples for GRANT EXECUTE all use objects, and no schemas
--1. Database1 - tables read only.
CREATE ROLE [ReallyReadOnly]
--give reader writes to this group
ALTER AUTHORIZATION ON SCHEMA::[db_datareader] TO [ReallyReadOnly]
--explicitly DENY access to writing
ALTER AUTHORIZATION ON SCHEMA::[DB_DenyDataWriter] TO [ReallyReadOnly]
--2. Database2 - GRANT Select / Insert / Delete data
CREATE ROLE [ProcWriter]
ALTER AUTHORIZATION ON SCHEMA::[db_datareader] TO [ProcWriter]
ALTER AUTHORIZATION ON SCHEMA::[db_datawriter] TO [ProcWriter]
--3. Database2 - GRANT Create / Alter procedure (delete action not required)
ALTER AUTHORIZATION ON SCHEMA::[db_ddladmin] TO [ProcWriter]
--4. Database2 - Execute all procedure/functions
--auto granted with datawriter?
--5. Database2 - User should not alter the table structure.
--loop thru all tables to "DENY ALTER ON [dbo].[eachtable] TO [ProcWriter]"
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!