Best practices for calling sp_executesql
Posted on 2006-07-20
I'm quite new to writing sp's. I'm making extensive use of exec sp_executesql and want to make sure that I get to know when things don't go right.
I know that sp_executesql returns zero on success, and also the @@error gets set to a non-zero value if there's a problem. Currently i'm checking both these values. Do I need to check both? Can problems occur that will cause one of them to be non-zero while the other is zero?
I just want to know what's the established way of trapping problems.