SQL Sever create a user with rights only to view a particular View or to execute only a particular stored procedure.

SQL Sever create a user with rights only to view a particular View or to execute only a particular stored procedure.
CREATE LOGIN user1 WITH PASSWORD = 'abc@123'
GO
CREATE USER user1
GO
CREATE ROLE AccessMonitoringViewRole;
GO
EXECUTE sp_addrolemember AccessMonitoringViewRole, user1
GO
--GRANT EXECUTE ON dbo.sproc1 TO execRole --this line is for granting execute on stored procedure
--below line is for granting view on a view
GRANT SELECT ON [dbo].[vAccessMonitoringView] TO AccessMonitoringViewRole
GO

Comments

Popular posts from this blog

Authorize.net Integration eCommerce Payment Gateway ( Direct Post Method New! )

Get Organised with OneNote

Test your Sql Query Online