You are a database developer. You plan to design a database solution by using SQL Server 2008. There are two schemas named Sales and Marketing. You are the owner of the Sales schema and the Marketing schema is owned by a user named MarketingUser. Users of the Marketing schema do not have permissions to access the Sales schema. You have permissions to create objects in all schemas in the database. The Sales schema has a table named Customers.You plan to create a stored procedure in the Marketing schema for the marketing team. The stored procedure will select data from the Customers table and will be owned by MarketingUser. You need to ensure that the marketing team is able to execute the stored procedure. What should you do?
A.
Create the procedure by using the EXECUTE AS SELF option.
B.
Create the procedure by using the EXECUTE AS CALLER option.
C.
Create the procedure by using the EXECUTE AS OWNER option.
D.
Create the procedure by using the EXECUTE AS USER=MarketingUser option.
Explanation:
EXECUTE AS SELF is equivalent to EXECUTE AS user_name, where the specified user is the person creating or altering the module. The actual user ID of the person creating or modifying the modules is stored in the execute_as_principal_id column in the sys.sql_modules or sys.service_queues catalog view.