Why does this query return different results when in a stored procedure?

后端 未结 2 1423
北恋
北恋 2021-01-05 15:51

Synopsis

I\'ve got a query with a WHERE clause that contains a condition that checks a NULLable column against a parameter that may be NULL, like so:

2条回答
  •  耶瑟儿~
    2021-01-05 16:25

    add this line of code

    >   WITH RECOMPILE
    

    in the beggining of the procedure, it makes sure to build a new execution plan, not depending in the previous execution.

提交回复
热议问题