OR Operator Short-circuit in SQL Server

后端 未结 3 1629
南笙
南笙 2020-11-27 22:22

I want to consult SQL Server OR short-circuit

Code:

   DECLARE @tempTable table
      (
         id int
      )
      INSERT @tempTable(id) values(1         


        
3条回答
  •  醉话见心
    2020-11-27 22:45

    Within SQL, there is no requirement that an OR clause breaks early. In other words, it is up to the optimizer whether to check both conditions simutaneously. I am not an expert in the MSSQL optimizer, but I have seen instances where the optimizer has and has not short circuited an OR clause.

提交回复
热议问题