Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


New Database role not adding 'db_datareader' as a securable


New Database role not adding 'db_datareader' as a securable

Author
Message
robinrai3
robinrai3
Valued Member
Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)

Group: General Forum Members
Points: 71 Visits: 348
hi All,

I have created a new database role "myNewRole" and wish to it to have select permissions on all tables and have grant persmissions to insert, delete ,update on several individual tables etc. I can add these ones no problem but when adding 'db_datareader' as a role i.e to get all select permissions I get error message (this is even for any other fixed roles)

Cannot find the object 'db_datareader', because it does not exist or you do not have permission.

The corresponding sql is

GRANT CONTROL ON ROLE::[db_datareader] TO [myNewRole] in scripter

any help guys ?
robinrai3
robinrai3
Valued Member
Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)

Group: General Forum Members
Points: 71 Visits: 348
hi All,

been playing with this for a while...

trying to add an existing fixed role to a new user defined role should work

exec sp_addrolemember @rolename = 'db_datareader', @membername='myNewRole'

but it does not and or trying to add 'db_datareader' as a securable does not work either...

but the following seems to

GRANT SELECT ON Schema::dbo to [myNewRole] can be added by this TSQL
Lowell
Lowell
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14944 Visits: 38940
this is how i usually create a role and then add various built in roles to it;
I hope this helps

CREATE ROLE [MyRole]
ALTER AUTHORIZATION ON SCHEMA::[db_ddladmin] TO [MyRole]
ALTER AUTHORIZATION ON SCHEMA::[db_datareader] TO [MyRole]
ALTER AUTHORIZATION ON SCHEMA::[db_datawriter] TO [MyRole]
GRANT EXECUTE,ALTER TO [MyRole]



Lowell

--
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!

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search