How do I create a new role in my database with my first name which is Denise, and add read only access on the HR user's EMPLOYEES table to this role.

link|improve this question
1  
What DBMS are you working with (SQL Server, MySQL, Oracle)? It differes just a bit depending on which DBMS you are referring to. Are you looking for T-SQL code or do it through a GUI or management tools? – Shawn Melton Jul 23 '11 at 3:08
Wouldn't the t-sql tag indicate the DBMS? – Quick Joe Smith Jul 23 '11 at 4:56
Well the OP tagged it with clustered-index, which has really nothing to do with the question. I would assume SQL Server is the DBMS but other DBMS questions show up on this site so I just put t-sql for now. – Shawn Melton Jul 23 '11 at 5:44
feedback

2 Answers

From the documentation on MSDN for Create Role and Grant select

create role denise identified by appropriateVariable;

grant select on HR.employees to denise;
link|improve this answer
6  
I'm torn here. I want to welcome another dba to the fold, but this answer is ... less than helpful. I've rewritten it a bit to show you no hard feelings. Welcome to the site, but can we try and put a tad more effort into the posts? :) – jcolebrand Jul 23 '11 at 3:50
3  
This syntax isn't SQL Server... – gbn Oct 8 '11 at 9:22
feedback

Using Adventureworks database as a reference, following shows sudo code

USE [AdventureWorks] 
GO  
CREATE ROLE [Denise] 
GO 
USE [AdventureWorks]  
GO  
GRANT SELECT ON [HumanResources].[Employee] TO [Denise]
GO
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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