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
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
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.
This is handled on the dependent level, rather than on the original object. The place to start is with the documentation on SCHEMABINDING
.
In practice, this means the following procedure:
It is a bit cumbersome, but it helps enforce database dependencies.