April 12, 2012 at 11:18 am
Hi, I had a request to give a new login datareader access to all databases within an instance.
Not seeing a server role that does this, I used sp_msforeachdb like this:
sp_msforeachdb 'USE [?] EXEC sp_addrolemember N''db_datareader'', <domain>\<id>'''
After this completed, I opened the user mapping property page for the login and see that db_datareader is checked for each database.
The Map checkbox is not checked. Will this prevent the user from reading the database even though db_datareader is checked? If so, is there a TSQL command that needs to be included in the above to also map the database to the login?
I don't want to send an email that they are all set up and then have them unable to SELECT from the databases. Thanks for reading.
April 12, 2012 at 12:22 pm
Did you create (or already have) the user in the database before you gave them permissions? That's the usual sequence.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 12, 2012 at 3:25 pm
Yes, the user exists ahead of time.
April 13, 2012 at 6:33 am
Should be fine then, I would think.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 13, 2012 at 1:52 pm
Does anyone know what the map checkbox does?
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply