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


New login & Access to DB


New login & Access to DB

Author
Message
OnlyOneRJ
OnlyOneRJ
Old Hand
Old Hand (300 reputation)Old Hand (300 reputation)Old Hand (300 reputation)Old Hand (300 reputation)Old Hand (300 reputation)Old Hand (300 reputation)Old Hand (300 reputation)Old Hand (300 reputation)

Group: General Forum Members
Points: 300 Visits: 690
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 w00tw00tw00tw00tw00t


Please help me with a query where in i can perform this activity easily :-(

************************************
Every Dog has a Tail !!!!! :-D
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: 14978 Visits: 39000
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 w00tw00tw00tw00tw00t


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

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

OnlyOneRJ
OnlyOneRJ
Old Hand
Old Hand (300 reputation)Old Hand (300 reputation)Old Hand (300 reputation)Old Hand (300 reputation)Old Hand (300 reputation)Old Hand (300 reputation)Old Hand (300 reputation)Old Hand (300 reputation)

Group: General Forum Members
Points: 300 Visits: 690
Thanks lowelll, willl try giving u complete proper info

************************************
Every Dog has a Tail !!!!! :-D
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