I have a stored procedure which contains a simple select statement on a table which I know doesn't exist in my Database. It compiles ok.
When I go to call the stored procedure I get the following error which is expected.
Server: Msg 208, Level 16, State 1, Procedure testproc, Line 8
Invalid object name 'testtable'.
My question I suppose is, How can I trap the fact that this error has occured if I call this stored procedure from another stored procedure.
I have tried something like this
declare @return int
exec @return = dbo.testproc
The error occurs but I can't seem to trapp it and cater for it.
Any help would be much appreciated