如果第一个条件为 FALSE,则在 SQL Server 中检查第二个条件?

If the first condition is FALSE then the second condition is checked in SQL Server?(如果第一个条件为 FALSE,则在 SQL Server 中检查第二个条件?)
本文介绍了如果第一个条件为 FALSE,则在 SQL Server 中检查第二个条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

where 子句中,如果第一个条件为 FALSE,那么在 SQL Server 中检查第二个条件?

In a where clause, if the first condition is FALSE, then the second condition is checked in SQL Server?

例如

select * 
from users
where (condition 1) AND (condition 2)

如果条件 1 为 False,是否会检查条件 2?

If condition 1 is False, will condition 2 be checked?

推荐答案

它是不确定的.您不能依赖评估顺序.

It is non-deterministic. You cannot rely on order of evaluation.

SQL Server 查询优化器负责解析 T-SQL 查询并根据表大小、索引等创建执行计划.因此,针对相同数据库架构的相同 T-SQL 语句可能会根据数据库内容、配置等执行不同的操作.

SQL Server query optimizer is responsible for parsing T-SQL query and creating execution plan based on table sizes, indexes, etc. So same T-SQL statement against same database schema might be executed differently depending on database content, configuration, etc.

查询优化器优先考虑执行速度,并能够并行执行单个 T-SQL 语句.过滤子句的执行最终一个接一个执行的可能性很小.

Query optimizer prioritizes speed of execution and is able to parallelise execution of a single T-SQL statement. It is highly unlikely that execution of filter clauses ends up being executed one after another.

这篇关于如果第一个条件为 FALSE,则在 SQL Server 中检查第二个条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Sending parameters to stored procedures vb.net(将参数发送到存储过程 vb.net)
Insert multiple rows, count based on another table columns(插入多行,根据另一个表列计数)
How to hold the location of an image in a SQL Server database?(如何在 SQL Server 数据库中保存图像的位置?)
How to send to email (outlook) the selected items in SQL Server database using vb.net(如何使用 vb.net 将 SQL Server 数据库中的选定项目发送到电子邮件(Outlook))
datagrid checkbox writes Null instead of 0 (false) into database(datagrid 复选框将 Null 而不是 0 (false) 写入数据库)
DBCC CheckDb-any ways to detect errors vb.net?(DBCC CheckDb-vb.net 有什么检测错误的方法吗?)