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