SQL Server 7.0 Allows Creation of a Procedure that References a Nonextant Table

SQL Server 7.0 uses deferred name resolution in stored procedures, triggers, and statement batches. It allows the creation of stored procedures that reference objects that do not yet exist. During compilation, all objects referenced in the stored procedure are resolved. At creation time, only syntax checking is done. The text of the stored procedure is stored in the syscomments system table. When a stored procedure is executed for the first time, the query processor reads the text of the stored procedure from the syscomments system table of the procedure and checks that the names of the objects used by the procedure are present. The stored procedure is then compiled to generate an execution plan when it is executed, if a valid plan does not already exist in the cache.

Thus, a syntactically correct stored procedure that references objects, which do not exist, can be created successfully. However, they will fail at execution time because referenced objects do not exist.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: