solving sql server problems for millions of dbas and developers since 2006



SQL Server DBA Tips SQL Server Developer Tips SQL Server Business Intelligence Tips SQL Server Career Tips SQL Server Whitepapers SQL Server Tools SQL Server Webcasts SQL Server Questions and Answers SQL Server Questions and Answers













SQL server 2008 Exp

Asked 2/10/2012 9:57:11 AM by Hansa

I'm new to sql server 2008 database.

Would like to know step-by-step how to give READ or WRITE data permission to windows user (group)  to a particular database name.



Answered 2/10/2012 11:59:37 AM by Jeremy Kadlec (0) vote answer is useful vote answer is NOT useful

Hansa,

I would check out this tip:

http://www.mssqltips.com/sqlservertip/1138/giving-and-removing-permissions-in-sql-server/

Please let me know if this answers your question.

Thank you,
Jeremy Kadlec


Answered 2/10/2012 1:00:25 PM by Hansa (0) vote answer is useful vote answer is NOT useful

Is there anyway I can create a Group within sql 2008.

For example: to give read only permission to 'ApFin' (database name)

                    1. Create a 'Grp_ReadOnly'    

                    2. Add list of users already created from local Windows OS.

                    3. set 'Grp_ReadOnly' group to  read  'ApFin' database


Answered 2/10/2012 1:33:28 PM by Jeremy Kadlec (0) vote answer is useful vote answer is NOT useful

Hansa,

If you want to give a group rights to read all tables and all views in a single database, I would suggest using db_datareader group.

I believe these are the steps you need to follow based on your follow-up question:

  • Create the SQL Server "login" for the Windows group

CREATE LOGIN [domainName\loginName] FROM WINDOWS;
GO

  • Grant the SQL Server login rights to the database which is called a SQL Server "user", even if it is a group

CREATE USER [loginName] FOR LOGIN [domainName\loginName] ;
GO

  • Grant the SQL Server user rights to the db_datareader group

exec sp_addrolemember db_datareader, [loginName]
go

Let me know if this answers your question.

Thank you,
Jeremy Kadlec



Post an Answer

Keep it clean and stay on the subject or we may delete your comment.
Your email address is not published. Required fields are marked with an asterisk (*)

*Name   *Email   Notify for updates
Comments
*Enter Code refresh code


 
Sponsor Information
"SQL doctor ROCKS! As soon as I ran it, problems that have been giving me headaches were identified and cured."

SQL Monitor, server monitoring so easy, your boss could do it. Try it online.

SQL Servers keeping you up at night? Contact the Edgewood SQL Server consultants for a Health Check.

Find and Fix SQL issues with Foglight Performance Analysis. Get a free copy.

Solving SQL Server problems for millions of DBAs and Devs since 2006. Join now.

Are you waiting on SQL Server? Learn about these DMV's.


Copyright (c) 2006-2012 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | about
authors | contribute | feedback | giveaways | user groups
Some names and products listed are the registered trademarks of their respective owners.


Edgewood Solutions LLC | MSSharePointTips.com | MSSQLTips.com