--- title: "XQueries Handling Relational Data | Microsoft Docs" ms.custom: "" ms.date: "03/03/2017" ms.prod: sql ms.prod_service: sql ms.reviewer: "" ms.technology: xml ms.topic: "language-reference" dev_langs: - "XML" helpviewer_keywords: - "relational data [XQuery]" - "XQuery, relational data" ms.assetid: 9812b71a-52ec-48a0-92f3-016a93660229 author: "rothja" ms.author: "jroth" --- # XQueries Handling Relational Data [!INCLUDE[tsql-appliesto-ss2012-xxxx-xxxx-xxx-md](../includes/tsql-appliesto-ss2012-xxxx-xxxx-xxx-md.md)] You specify XQuery against an **xml** type column or variable by using one of the [XML Data Type Methods](../t-sql/xml/xml-data-type-methods.md). 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)](../xquery/xquery-extension-functions-sql-column.md) and [sql:variable() function (XQuery)](../xquery/xquery-extension-functions-sql-variable.md). ## See Also [XML Data (SQL Server)](../relational-databases/xml/xml-data-sql-server.md) [XQuery Language Reference (SQL Server)](../xquery/xquery-language-reference-sql-server.md) [XML Construction (XQuery)](../xquery/xml-construction-xquery.md)