SQL Server 2012 User Defined Server Roles

Hi Friends,

Today, I want to focus on a very helpful feature SQL Server 2012 User Defined Server Roles (Denali).

In SQL Server 2005 and SQL Server 2008, there are only nine fixed server roles to grant the permissions. These nine fixed server roles are shown below in figure:

1_SQL_Server_2012_User_Defined_Server_Role

Now with SQL Server 2012 we can create user defined Server Roles using TSQL as well as SSMS.

Creating Server role using TSQL:

Here for testing purpose, I am creating a new role TestRole and granting Trace Event Notification permission.

USE [master]
GO
CREATE SERVER ROLE [TestRole]
GO
GRANT CREATE TRACE EVENT NOTIFICATION TO [TestRole]

Here, I have already created a login SQLGEEK. Now I am just adding this login as a member to newly created server role:

ALTER SERVER ROLE [TestRole] ADD MEMBER [SQLGEEK]

Creating Server role using SSMS:

1- Open the SQL Server instance in SSMS.

2- Expand the object explorer.

3- Expand the security node.

4- Now Right Click on Server Roles under security node and click on properties

2_SQL_Server_2012_User_Defined_Server_Role

5- This will open new server role window. Here on general page fill all the details like role name, check on servers option under securable and assign permissions under explicit.

3_SQL_Server_2012_User_Defined_Server_Role

   

6- Now go to Members page on this window and add the login under this Server Role. Here, I have already created a new login SQLGEEK. So, I am just adding this login:

4_SQL_Server_2012_User_Defined_Server_Role

7- If you want to assign any existing server Role Membership for this user defined  server role, then go to Memberships page and select the existing server role.

5_SQL_Server_2012_User_Defined_Server_Role

8- Click OK.

 

Regards

Prince Rastogi

Like us on FaceBook Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook

   

About Prince Rastogi

Prince Rastogi is working as Database Administrator at Elephant Insurance, Richmond. He is having more than 8 years of experience and worked in ERP Domain, Wealth Management Domain. Currently he is working in Insurance domain. In the starting of his career he was working on SQL Server, Internet Information Server and Visual Source Safe. He is post graduate in Computer Science. Prince is ITIL certified professional. Prince likes to explore technical things for Database World and Writing Blogs. He is Technical Editor and Blogger at SQLServerGeeks.com. He is a regular speaker at DataPlatformDay events in Delhi NCR. He has also presented some in depth sessions about SQL Server in SQL Server Conferences in Bangalore.

View all posts by Prince Rastogi →

Leave a Reply

Your email address will not be published.