0

Can anyone help me on this regarding by providing the exact code?

I need to create two Logins named (Groups) 1. Dev_S 2. Dev_T

Each Group has exactly fifty (50) Users (as Dev_S1, Dev_S2, Dev_S3 so on) in it.

How can I add these 50 users to the Groups.

Out of 50 users in each groups only 5 users needs db_datawriter rights and the rest needs db_datareader rights.

How can I grant access to these users?

Thanks in advance.

Regards,

Krish.

1

If I understand where you are trying to go, have your Active Directory administrator create your groups based upon the access they will be given and have each of the appropriate users added to their respective group.

In SQL Server you then run:

CREATE LOGIN [Domain\LoginName] FROM WINDOWS WITH DEFAULT_DATABASE = [master] GO

Followed by

USE DatabaseName EXEC sp_addrolemember N'db_datareader','[Domain\LoginName]'

All of the users your AD Admin placed into group LoginName now have db_datareader access to database DatabaseName.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.