Error in search condition to CONTAINS in a variable is not trappable in local scope - by Erland Sommarskog

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


5
0
Sign in
to vote
ID 640242 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 1/29/2011 11:00:17 AM
Access Restriction Public

Description

If you have a statement with a CONTAINS expression, and the search condition is syntactically incorrect, you cannot trap this in a local CATCH block, only in an outer block. I know that compilation errors are not trappable locally, but this is absolutely not a compilation error, but strictly a run-time error. The error should be caught locally.
Sign in to post a comment.
Posted by Microsoft on 2/16/2011 at 2:31 PM
This issue has been fixed. It will ship in a future SQL 11 CTP. Thanks for reporting it.

-Adam
Posted by Microsoft on 2/16/2011 at 2:31 PM
This issue has been fixed. It will ship in a future SQL 11 CTP. Thanks for reporting it.

-Adam
Posted by Microsoft on 2/2/2011 at 3:54 PM
Hi Erland,

One would think the error your seeing is a runtime error (becuase of the parameterization) - but it's actually a compile time error. Contains queries will not compile without the ability to sniff the parameter value for the search query. So, the error is being thrown during parameter sniffing at compile time (actually a recompile triggered when we get to executing the select + contains) which makes it un-catchable.

I'm still investigating to see if there is anything we can do about this.