Real World DBA

Making Life Easier for SQL Server DBAs

Archive for June, 2008

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

Posted in 2008, Administration | Tagged: , , , , , , , , , , , | Leave a Comment »