给定以下存储过程定义
create procedure myproc
as
select *
from sometablethatdoesnotexist
select somecolumnthatdoesnotexist
from sometablethatdoesexist
如果在创建存储过程时这些对象(列或表)不存在,是否可以将sql-server(或localdb)配置为使存储过程的创建失败?
给定以下存储过程定义
create procedure myproc
as
select *
from sometablethatdoesnotexist
select somecolumnthatdoesnotexist
from sometablethatdoesexist
如果在创建存储过程时这些对象(列或表)不存在,是否可以将sql-server(或localdb)配置为使存储过程的创建失败?
2条答案
按热度按时间z0qdvdin1#
No.
This is SQL Server's deferred name resolution.
There is no way of turning it off . It will fail if you reference a non existent column on an existing table though.
bxfogqkk2#
对于任何人谁绊倒在这个问题上,有一个黑客概述https://dba.stackexchange.com/users/11635/geoff-patterson这里https://dba.stackexchange.com/questions/13522/is-there-a-way-to-force-deferred-name-resolution-even-if-the-table-exists-when-c
下面是他的代码示例-临时表是关键。