Background
My application is backed up by an SQL Server (2008 R2), and have quite a few SP, triggers etc..
My goal is to make sure upon program start that all of those objects are still valid.
For example, if I have a stored procedure A which calls stored procedure B, If someone changes the the name of B to C, I would like to get a notification when running my application in Debug environment.
What have I tried?
So, I figured using sp_refreshsqlmodule which according to the documentation returns 0 (success) or a nonzero number (failure):
DECLARE @RESULT int
exec @RESULT = sp_refreshsqlmodule N'A' --In this case A is the SP name
SELECT @@ERROR
SELECT @RESULT
So I changed SP B name to C and ran the script.
The results where:
@@ERRORwas0@RESULTwas0- I got a message of:
The module 'A' depends on the missing object 'B'. The module will still be created; however, it cannot run successfully until the object exists.
My question:
Am I missing something here, shouldn't I get anon-zero number that indicates that something went wrong?