filmov
tv
How To Create Read Only Server Role In SQL Server 2017
![preview_player](https://i.ytimg.com/vi/Gs5rAhdb4EQ/maxresdefault.jpg)
Показать описание
--Step1:Create Server Role with Required Privileges
CREATE SERVER ROLE Readonly
GO
GRANT CONNECT ANY DATABASE TO Readonly
GO
GRANT SELECT ALL USER SECURABLES TO Readonly
GO
--Step2:create login and add to the above role.
USE [master]
GO
CREATE LOGIN [testuser] WITH PASSWORD=N'123'
Go
ALTER SERVER ROLE [Readonly] ADD MEMBER [testuser]
GO
Don't forget to subscribe to our channel.
CREATE SERVER ROLE Readonly
GO
GRANT CONNECT ANY DATABASE TO Readonly
GO
GRANT SELECT ALL USER SECURABLES TO Readonly
GO
--Step2:create login and add to the above role.
USE [master]
GO
CREATE LOGIN [testuser] WITH PASSWORD=N'123'
Go
ALTER SERVER ROLE [Readonly] ADD MEMBER [testuser]
GO
Don't forget to subscribe to our channel.