Skip to content

Latest commit

 

History

History
45 lines (40 loc) · 2.1 KB

File metadata and controls

45 lines (40 loc) · 2.1 KB
description Logical Operators (Transact-SQL)
title Logical Operators (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 03/06/2017
ms.prod sql
ms.prod_service sql-database
ms.reviewer
ms.technology t-sql
ms.topic reference
dev_langs
TSQL
helpviewer_keywords
operators [Transact-SQL], logical
testing truth
truth testing
TRUE
FALSE
logical operators [SQL Server], Transact-SQL
ms.assetid edd92f08-76fb-4fd7-a4b6-8520d6a81df1
author cawrites
ms.author chadam

Logical Operators (Transact-SQL)

[!INCLUDE SQL Server]

Logical operators test for the truth of some condition. Logical operators, like comparison operators, return a Boolean data type with a value of TRUE, FALSE, or UNKNOWN.

Operator Meaning
ALL TRUE if all of a set of comparisons are TRUE.
AND TRUE if both Boolean expressions are TRUE.
ANY TRUE if any one of a set of comparisons are TRUE.
BETWEEN TRUE if the operand is within a range.
EXISTS TRUE if a subquery contains any rows.
IN TRUE if the operand is equal to one of a list of expressions.
LIKE TRUE if the operand matches a pattern.
NOT Reverses the value of any other Boolean operator.
OR TRUE if either Boolean expression is TRUE.
SOME TRUE if some of a set of comparisons are TRUE.

See Also

Operator Precedence (Transact-SQL)