How to Create Database Role in SQL Server - SQL Server DBA Tutorial

In this video you will learn how to create database role in SQL Server databases using SQL Server Management studio as well as T-SQL Script. This video demonstrates best practices of creating user defined database roles, how to add users to newly created database roles, how to add database objects to a database role.

Script used in this video to Create Database Role in SQL Server

USE [SalesOrders]
GO
 
CREATE ROLE [CustTableReader] AUTHORIZATION [TECHBROTHERS\kscott]
GO
 
USE [SalesOrders]
GO
 
ALTER AUTHORIZATION ON SCHEMA::[dbo] TO [CustTableReader]
GO
 
USE [SalesOrders]
GO
 
GRANT SELECT ON [dbo].[Customers] TO [CustTableReader]
GO
 
USE [SalesOrders]
GO
 
GRANT UPDATE ON [dbo].[Customers] TO [CustTableReader]
GO
 
USE [SalesOrders]
GO
 
GRANT VIEW DEFINITION ON [dbo].[Customers] TO [CustTableReader]
GO




Create Database Role in SQL Server