HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

How To Grant View Definition of Object in SQL Azure

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
definitionsqlgrantviewazurehowobject

Problem

The tsql syntax throws an error about "view" in SQL Azure, but functions on SQL Server:

GRANT VIEW ON OBJECT dbo::foo TO [bar]


Can access be granted in SQL Azure to view the definition of an object outside of db_owner?

Solution

Your syntax is incorrect. It should be

GRANT VIEW DEFINITION ON  TO 


Example

GRANT VIEW DEFINITION ON SCHEMA::dbo TO [bar]

GRANT VIEW DEFINITION ON OBJECT::dbo.MyView TO [barRole]

Code Snippets

GRANT VIEW DEFINITION ON <object/schema> TO <user/role>
GRANT VIEW DEFINITION ON SCHEMA::dbo TO [bar]

GRANT VIEW DEFINITION ON OBJECT::dbo.MyView TO [barRole]

Context

StackExchange Database Administrators Q#244867, answer score: 4

Revisions (0)

No revisions yet.