Ownership Chains

Stored procedures and views depend on other objects in the database such as tables, views, or other stored procedures. These dependencies are sometimes referred to as an ownership chain. In most situations, the user who owns the stored procedure or view also owns the underlying objects as well and, in most cases, all the underlying objects reside in the same database as the new object.

When a user accesses a view or a stored procedure, SQL Server won't check the permissions on the underlying objects if the same user owns all the objects and all the objects reside in the same database. It checks the permissions only on the stored procedure or view. If any of the objects are owned by different users or reside in different databases, ...

Get Writing Stored Procedures for Microsoft SQL Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.