Repository navigation
Describe the UNKNOWN result of ALL and SOME or ANY - #10485
Rudi Bruchez (rudi-bruchez) wants to merge 1 commit into
Conversation
|
Rudi Bruchez (@rudi-bruchez) : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
|
Learn Build status updates of commit 9aebc6e: ✅ Validation status: passed
For more details, please refer to the build report. |
|
Rudi Bruchez (@rudi-bruchez) : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, and the documentation changes clearly address the FALSE and UNKNOWN outcomes for ALL, SOME, and ANY.
No open issues 🎉
What changed in this PR
Updates the Transact-SQL reference pages for ALL and SOME | ANY to accurately document three-valued comparison results, including UNKNOWN outcomes.
Changes:
- Clarifies when ALL returns FALSE and when the result is UNKNOWN.
- Clarifies when SOME or ANY returns FALSE and when the result is UNKNOWN.
| File | Description |
|---|---|
| docs/t-sql/language-elements/some-any-transact-sql.md | Updates the SOME and ANY result-value description to document FALSE and UNKNOWN outcomes. |
| docs/t-sql/language-elements/all-transact-sql.md | Updates the ALL result-value description to document FALSE and UNKNOWN outcomes. |
Review effort: Lite
|
Umachandar Jayachandran (@uc-msft) Can you review the proposed changes? Important: When the changes are ready for publication, adding a #label:"aq-pr-triaged" |
What's wrong
The "Result value" section of the
ALLpage says: "Returns TRUE when the comparison specified is TRUE for all pairs ... Otherwise returns FALSE." TheSOME | ANYpage says the same: "otherwise, returns FALSE."When a NULL value takes part in the comparison and decides the result, both return UNKNOWN: neither the condition nor its negation is true.
1 < ALL (2, NULL)isn't FALSE, sinceNOT (1 < ALL (2, NULL))isn't TRUE either. A reader who relies on "otherwise FALSE" writesNOT (x < ALL (...))and gets no rows.Evidence
SQL Server 2025 CU10 (17.0.5035.5), Linux container, Developer edition. No database needed; default
SEToptions ofsqlcmd -I(ANSI_NULLS ON).1 < ALL (2, 3)1 < ALL (2, NULL)3 < ALL (2, NULL)1 < ALL (empty)NULL < ALL (2, 3)3 > ANY (2, NULL)1 > ANY (2, NULL)1 > ANY (2, 3)1 > ANY (empty)Observed: UNKNOWN for
1 < ALL (2, NULL),NULL < ALL (2, 3)and1 > ANY (2, NULL). Expected per the current text: FALSE.Change
In both pages, keeps the TRUE condition, gives the FALSE condition, and says that the result is otherwise UNKNOWN. The text doesn't tie UNKNOWN to NULL values:
1 = ANY (1, NULL)is TRUE, and withANSI_NULLS OFFcomparisons with NULL can be TRUE or FALSE.