Sunday, September 20, 2009

Stored Procedures : Execute as owner

Using EXECUTE AS OWNER in a stored procedure definition allows you to raise permissions for the execution of the procedure.

This enables a application login with low privileges to perform owner (dbo) privileged functionality using just the execute permissions on the sproc.

CREATE PROCEDURE dbo.EmptyMyTable
WITH EXECUTE AS OWNER
AS
BEGIN
TRUNCATE dbo.TableA
END

Clay Lenhart : SQL Server Security with EXECUTE AS OWNER

No comments: