November 27, 2012 at 5:18 am
Hi Friends,
i have asked to perfrom a task to create a New login & then provide the access rights to a particular DB..
I did it with no time 🙂
After this i am asked to create 50 New Login's & give them DB access privilages to each of them..
The total Databses are 150 :w00t::w00t::w00t::w00t::w00t:
Please help me with a query where in i can perform this activity easily 🙁
************************************
Every Dog has a Tail !!!!! :-D
November 27, 2012 at 5:52 am
runal_jagtap (11/27/2012)
Hi Friends,i have asked to perfrom a task to create a New login & then provide the access rights to a particular DB..
I did it with no time 🙂
After this i am asked to create 50 New Login's & give them DB access privilages to each of them..
The total Databses are 150 :w00t::w00t::w00t::w00t::w00t:
Please help me with a query where in i can perform this activity easily 🙁
Well, in general, you create multiple roles, each containing the permissions you want to give, and then you create users, to match the logins, in each database, and assign them to the appropriate roles.
In your case, you didn't give any information about the details, so we cannot help much with that.
are the permissions going to be exactly the same for all 150 databases? does every login have access to all 150 databases?
when you define that, we could offer scripts that use things like sys.databases to generate a script for each database;
something like this:
EXEC sp_MSforeachdb
'SELECT
''USE [?]
GO
CREATE ROLE [AlmostOwners]
EXEC sp_addrolemember N''''db_ddladmin'''', N''''AlmostOwners''''
EXEC sp_addrolemember N''''db_datareader'''', N''''AlmostOwners''''
EXEC sp_addrolemember N''''db_datawriter'''', N''''AlmostOwners''''
--can the users EXECUTE procedures? comment out if false
GRANT EXECUTE TO [AlmostOwners]
--allow the users to see view proc and function definitions
Grant View Definition ON SCHEMA::[dbo] To [AlmostOwners]
GO
'''
Lowell
November 29, 2012 at 1:08 am
Thanks lowelll, willl try giving u complete proper info
************************************
Every Dog has a Tail !!!!! :-D
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply