Skip to content

Commit 37f4180

Browse files
MSFTPawelMMashaMSFT
authored andcommitted
Clarify error handling in XQuery documentation
Add note about parsing errors and transaction behavior. This was clarified as part of RFC 13225131 Add note about xquery parser error handling Added note about XQuery parser errors and transaction behavior. This was clarified as part of RFC 13225131 edit
1 parent d8d67e6 commit 37f4180

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

docs/t-sql/xml/guidelines-for-using-xml-data-type-methods.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ Msg 2396, Level 16, State 1:
6060
XQuery [xmldb_test.xmlcol.query()]: Attribute may not appear outside of an element
6161
```
6262

63+
> [!NOTE]
64+
> Parsing errors raised by the XQuery parser (such as syntax errors in the XML referenced as part of the XML data type method, for example), abort the active transaction, regardless of the [XACT_ABORT](../statements/set-xact-abort-transact-sql.md) setting of the current session.
65+
6366
## Singleton Checks
6467

6568
Location steps, function parameters, and operators that require singletons will return an error if the compiler cannot determine whether a singleton is guaranteed at run time. This problem occurs frequently with untyped data. For example, the lookup of an attribute requires a singleton parent element. An ordinal that selects a single parent node is sufficient. The evaluation of a **node()**-**value()** combination to extract attribute values may not require the ordinal specification. This is shown in the next example.

docs/xquery/error-handling-xquery.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ dev_langs:
2626
As a deviation from the W3C standard, XQuery run-time errors are converted into empty sequences. These sequences may propagate as empty XML or NULL to the query result, depending upon the invocation context.
2727

2828
Explicit casting to the correct type allows users to work around static errors, although run-time cast errors will be transformed to empty sequences.
29+
30+
> [!NOTE]
31+
> Parsing errors raised by the XQuery parser (such as syntax errors in the XML referenced as part of the XML data type method, for example), abort the active transaction, regardless of the [XACT_ABORT](../t-sql/statements/set-xact-abort-transact-sql.md) setting of the current session.
2932
3033
## Static Errors
3134
Static errors are returned by using the [!INCLUDE[tsql](../includes/tsql-md.md)] error mechanism. In [!INCLUDE[ssNoVersion](../includes/ssnoversion-md.md)], XQuery type errors are returned statically. For more information, see [XQuery and Static Typing](../xquery/xquery-and-static-typing.md).

0 commit comments

Comments
 (0)