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:
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.
CREATE SERVER ROLE [TestRole]
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
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.
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:
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.
8- Click OK.