Why does Microsoft SQL Server check columns but not tables in stored procs?

前端 未结 2 461
难免孤独
难免孤独 2020-12-25 14:42

Microsoft SQL Server seems to check column name validity, but not table name validity when defining stored procedures. If it detects that a referenced table name exists cur

2条回答
  •  既然无缘
    2020-12-25 15:30

    This article in MSDN should answer your question.

    From the article:

    When a stored procedure is executed for the first time, the query processor reads the text of the stored procedure from the sys.sql_modules catalog view and checks that the names of the objects used by the procedure are present. This process is called deferred name resolution because table objects referenced by the stored procedure need not exist when the stored procedure is created, but only when it is executed.

提交回复
热议问题