Real World DBA

Making Life Easier for SQL Server DBAs

Deferred Name Resolution, or “Why does my proc allow invalid table names?”

Posted by mxhxrdba on June 4, 2008

A developer came to me a few days ago, wondering why when he specifies an invalid table name in a stored procedure, the proc saves to the database, but when he specifies an invalid column name it fails.

Looks like the deferred name resolution only works w/ missing tables…not w/ missing columns: http://msdn.microsoft.com/en-us/library/ms190686.aspx

For instance, this succeeds on an DB:

create proc cp_test
as
select somecolumn from tFakeTable –fake column, fake table

This fails on an DB:

create proc cp_test2
as
select somecolumn from tActualTable–fake column, real table

One Response to “Deferred Name Resolution, or “Why does my proc allow invalid table names?””

  1. kiviffnab said

    Wow, I didn’t heard about this topic up to the present. Cheers!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>