Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 2.03 KB

xqueries-handling-relational-data.md

File metadata and controls

38 lines (28 loc) · 2.03 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords dev_langs
XQueries Handling Relational Data
Learn how to bind non-XML relational data to XML by using the XQuery extensions sql:column() and sql:variable().
rothja
jroth
03/03/2017
sql
xml
reference
relational data [XQuery]
XQuery, relational data
XML

XQueries Handling Relational Data

[!INCLUDE SQL Server Azure SQL Database]

You specify XQuery against an xml type column or variable by using one of the XML Data Type Methods. These include query(), value(), exist(), or modify(). The XQuery is executed against the XML instance identified in the query generating the XML.

The XML generated by the execution of an XQuery can include values retrieved from other Transact-SQL variable or rowset columns. To bind non-XML relational data to the resulting XML, SQL Server provides the following pseudo functions as XQuery extensions:

  • sql:column() function

  • sql:variable() function

You can use these XQuery extensions when specifying an XQuery in the query() method of the xml data type. As a result, the query() method can produce XML that combines data from XML and non-xml data types.

You can also use these functions when you use the xml data type methods modify(), value(), query(), and exist() to expose a relational value inside XML.

For more information, see sql:column() function (XQuery) and sql:variable() function (XQuery).

See Also

XML Data (SQL Server)
XQuery Language Reference (SQL Server)
XML Construction (XQuery)