How to create customized/user defined database role in SQL Server

The below query will tell you how to create customized database role in sql server. Based on this we can handle customized permissions at database level.

Creating user defined or customized database role in sql server

USE Test
GO
CREATE ROLE [TestRole]
AUTHORIZATION [dbo]
Go
--- Step 2 -------- Assign Permissions to role  ------------
USE Test
GO
GRANT ALTER,EXECUTE, SELECT,INSERT,UPDATE,DELETE
ON SCHEMA ::dbo
TO [TestRole]
Go

Sometimes we might find difficulties while dropping customized database roles . So we can run the below query in order to find that

ALTER AUTHORIZATION 
ON SCHEMA::oldschema TO dbo 
go
USE Test
GO
DROP ROLE [TestRole]

Comments

Popular posts from this blog

System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out

Pre login Handshake or Connection Timeout Period

Transparent Data Encryption(TDE) with Master Key and Certificate in SQL Server