Bookmark and Share
Grant privileges and Execute queries
(Publish Date: 2014-6-4 4:00pm, Total Visits: 692, Today: 2, This Week: 3, This Month: 10)

--change the execution context to a specific USER

GRANT SELECT ON DBschema.product to MyLogin;
GO

EXECUTE AS USER = 'MyLogin';

GO

The following query is ok.

SELECT * FROM DBschema.product;
GO
 
The following query is denied, since MyLogin doesn't have SELECT privilege on the table zipcode.

SELECT * FROM DBschema.zipcode;
GO

-- Revert to the administrator security context

REVERT;
GO