SQL Server 2012 - How to Grant Access to a Schema for ALL USERS?

What is the syntax for me Granting Access to a newly created SCHEMA? I want all users to be able to do anything within this Schema.
LVL 17
MIKESoftware Solutions ConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lcohanDatabase AnalystCommented:
USE [YourDB]
GO
CREATE ROLE [SchemaAccess] AUTHORIZATION [YourSchemaNameHere]
GO

ALTER AUTHORIZATION ON SCHEMA::[YourSchemaNameHere] TO [SchemaAccess]
GO

--or to create new schema

CREATE SCHEMA [YourSchemaNameHere1] AUTHORIZATION [SchemaAccess]
GO


--then just add all users you want to that [SchemaAccess] DB Role - you can put this in a dynamic sql.

sp_addrolemember 'SchemaAccess', 'User1'
sp_addrolemember 'SchemaAccess', 'User2'

...
sp_addrolemember 'SchemaAccess', 'UserN'
0
Russell FoxDatabase DeveloperCommented:
If your Public server role is active:
GRANT CONTROL ON SCHEMA :: YourSchema TO PUBLIC;

Open in new window

0
Mandeep SinghDatabase AdministratorCommented:
Hi,

Russell Fox is right, you can also use it:

Granting SELECT permission on schema Person to database user JILL

GRANT CONTROL ON SCHEMA :: YOURSCHEMA TO JILL

Open in new window

0
Scott PletcherSenior DBACommented:
I wouldn't give CONTROL, as I wouldn't want them altering the authorization on the schema itself ... or just dropping the schema!

It's somewhat lengthier, but I'd explicitly list the permission(s) I wanted them to have:

GRANT
    ALTER, --unavoidable, unfortunately, since it has big security risks as well
    EXECUTE, INSERT, DELETE, UPDATE,
    SELECT, REFERENCES, VIEW CHANGE TRACKING, VIEW DEFINITION
ON SCHEMA::schema_name
TO public
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.