[英]Altering a stored procedure not throwing “Invalid column name” error when that particular column is removed from the table in SQL Server
I have removed a column from a table which is referred in a stored procedure.我从存储过程中引用的表中删除了一个列。 When I alter that stored procedure, there is no error, but when executing it, an error
当我更改该存储过程时,没有错误,但是在执行它时,出现错误
Invalid column name
列名无效
is thrown.被抛出。
I'm using SSMS 2017我正在使用 SSMS 2017
You are looking for functionality called "schema binding".您正在寻找称为“模式绑定”的功能。 This means that if you cannot change the schema of an object if it is being referenced in a view or stored procedure.
这意味着如果 object 在视图或存储过程中被引用,则无法更改它的架构。
This is handled on the dependent level, rather than on the original object.这是在依赖级别上处理的,而不是在原始 object 上处理。 The place to start is with the documentation on
SCHEMABINDING
.开始的地方是
SCHEMABINDING
上的文档。
In practice, this means the following procedure:在实践中,这意味着以下程序:
It is a bit cumbersome, but it helps enforce database dependencies.这有点麻烦,但它有助于强制执行数据库依赖关系。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.