0
我觉得这很难测试/研究,所以我问:在OR
类似于where (1 = 1) OR (column1 = @value)
条件,第二部分,例如:column1 = @value
曾经被测试?如果可能的话,请提供文档...Sql Server比较行为
我觉得这很难测试/研究,所以我问:在OR
类似于where (1 = 1) OR (column1 = @value)
条件,第二部分,例如:column1 = @value
曾经被测试?如果可能的话,请提供文档...Sql Server比较行为
根据这个帖子由姆拉登Prajdić,答案是否定的,SQL Server不会做短路的OR条件:
而且,看到this post.
如果订单对您很重要,您可以使用CASE WHEN
声明。 SQL Server始终按顺序评估CASE WHEN
条件。
它被称为短路,SQL Server不做*做。请参阅http://stackoverflow.com/questions/11219791/or-operator-short-circuit-in-sql-server和http://weblogs.sqlteam.com/jeffs/archive/2008/02/22/sql-server -short-circuit.aspx – LittleBobbyTables
检查[此问题](http://dba.stackexchange.com/questions/5333/logical-operators-or-and-in-condition-and-order-of-conditions-in-where )也 –