If we want to provide view object definition rights to a specific user with the public role on all databases, execute the following query

USE master 
GO 
GRANT VIEW ANY DEFINITION TO user01
USE master 
GO 
GRANT VIEW ANY DEFINITION TO [DOMAIN01\user01]

If we want to provide view object definition rights to a specific user with a public role on a specific database, execute the following query

USE MyDb01
GO 
GRANT VIEW DEFINITION TO user01

USE MyDb01 
GO 
GRANT VIEW Definition TO [Domain01\user01]

To grant View Definition rights to a specific user and an object for a particular database

GRANT VIEW DEFINITION on [HumanResources].[vEmployee] TO user01

Sources:

Last modified: May 4, 2021

Author

Comments

Write a Reply or Comment