Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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.

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

2 Answers 2

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
share|improve this answer

From the documentation on MSDN for Create Role and Grant select

create role denise identified by appropriateVariable;

grant select on HR.employees to denise;
share|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
4  
This syntax isn't SQL Server... –  gbn Oct 8 '11 at 9:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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