You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/claude/function-coverage-todo.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,7 +144,6 @@ Functions that exist only in Azure SQL Database / Fabric surfaces, not in the SQ
144
144
145
145
Real bugs / limitations against shipped functions — fixes are tickable work, not design decisions.
146
146
147
-
-[ ]**OPENJSON ... WITH ... AS JSON** on `nvarchar(max)` raises `NotSupportedException` (sub-tree extraction missing); non-`nvarchar(max)` raises Msg 13618.
148
147
-[ ]**REPLICATE** of a MAX-typed *column* reference truncates to 8000 bytes (parse-time type resolver doesn't reach FROM-source columns; literal / CAST-target inputs work).
149
148
-[ ]**GROUPING / GROUPING_ID** only accept `Reference` arguments — `GROUPING(a+1)` paired with `GROUP BY a+1` always raises Msg 8161 instead of matching structurally.
150
149
-[ ]**STRING_SPLIT(..., ..., CAST(@v AS INT))** wrapped-variable accepted; real SQL Server rejects all variable-bearing `enable_ordinal` shapes regardless of wrapping.
Copy file name to clipboardExpand all lines: docs/claude/json.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,9 @@ Value formatting matches real SQL Server byte-for-byte except float / real (docu
21
21
- other strings → JSON-escaped (`\"``\\``\b``\f``\n``\r``\t``\uHHHH` for control chars; non-ASCII / `/` / `<` / `>` left literal)
22
22
- nested `JSON_OBJECT` / `JSON_ARRAY` / `JSON_QUERY` results — embedded **raw** (not re-quoted), via compile-time `JsonValueRender.ProducesJson(Expression)` detection that unwraps `Parenthesized`. Other strings — including `'{"x":1}'` literals — go through the quote-and-escape path, matching SQL Server's JSON-typed-input detection without needing an `SqlValue`-level marker bit.
23
23
24
-
`OPENJSON(json [, doc_path]) [WITH (col TYPE [path] [AS JSON], …)]` — rowset-returning, structurally a new FromSource kind. Without WITH: default schema `(key nvarchar, value nvarchar, type int)` — type codes 0=null/1=string/2=number/3=bool/4=array/5=object. With WITH: each column extracts via `$.<col-name>` (default) or explicit `'$path'`; primitive collections use `'$'`. `AS JSON` modifier → `NotSupportedException` on `nvarchar(max)` (sub-tree extraction not modeled, even though real SQL Server accepts the column form there); on a non-`nvarchar(max)` column `AS JSON` raises **Msg 13618**, matching real. NULL/invalid JSON → zero rows under lax.
24
+
`OPENJSON(json [, doc_path]) [WITH (col TYPE [path] [AS JSON], …)]` — rowset-returning, structurally a new FromSource kind. Without WITH: default schema `(key nvarchar, value nvarchar, type int)` — type codes 0=null/1=string/2=number/3=bool/4=array/5=object, unfolding the root one row per array element / object property. With WITH: column paths are root-relative — an **array root yields one row per element** (paths relative to the element), an **object root yields a single row** (paths relative to the root). Each column extracts via `$.<col-name>` (default) or explicit `'$path'`; primitive collections use `'$'`. NULL/invalid JSON → zero rows under lax.
25
+
26
+
`AS JSON` column modifier — accepted only on `nvarchar(max)` (any other declared type raises **Msg 13618** at parse). Extracts the matched subtree via the shared `JsonSubtree.Extract` (the same rule backing `JSON_QUERY`): object/array → verbatim source text (whitespace and key order preserved, via `JsonElement.GetRawText`); JSON `null` → SQL NULL in both modes; any other (non-null) scalar → SQL NULL in lax, **Msg 13624** in strict; a missing path → SQL NULL in lax, **Msg 13608 State 6** in strict (the OPENJSON-context state, threaded through `JsonPath.Walk`'s `strictNotFoundState` — JSON_VALUE reports State 2, JSON_QUERY/JSON_MODIFY State 1).
25
27
26
28
OPENJSON WITH-clause types: `int`/`bigint`/`decimal(p,s)`/`float`/`bit`/`nvarchar(N|max)`/`varchar(N)`/`date`/`datetime2(N)`/`datetimeoffset(N)`/`uniqueidentifier`. Coercion via `SqlValue.CoerceTo`. Backed by `System.Text.Json`. JSON-path quoted-property escape `""` → literal `"`.
0 commit comments