我正在为一家拥有 SQL Server 2008 的公司做一些工作。他们的一个存储过程引用(或似乎引用)一个不存在的列,但没有错误。
查询具有以下结构:
select col1, col2 from FOO
where col3 in
(select id from BAZ where datecreated between @date1 and @date2)
** BAZ 不包含名为 [datecreated] 的列,但 FOO 包含。** 如果我更改查询以限定列名,如下所示,会出现错误:
select col1, col2 from FOO
where b in
(select id from BAZ where BAZ.datecreated between @date1 and @date2)
如果这是设计行为,有人可以指点我相关的文档吗?谢谢