Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 1.17 KB

namespace-support-in-path-mode.md

File metadata and controls

33 lines (26 loc) · 1.17 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic helpviewer_keywords
Namespace Support in PATH Mode
Learn about namespace support when using PATH mode to generate XML from a SELECT query.
MikeRayMSFT
mikeray
randolphwest
05/05/2022
sql
xml
conceptual
PATH FOR XML mode, namespace support
namespaces [XML in SQL Server]

Namespace support in PATH mode

[!INCLUDE SQL Server Azure SQL Database]

Namespace support in the PATH mode is provided by using WITH NAMESPACES. For example, the following query demonstrates the WITH NAMESPACES syntax to declare a namespace ("a:") that can then be used in the subsequent SELECT statement:

WITH XMLNAMESPACES('a' as a)
SELECT 1 as 'a:b'
FOR XML PATH;

Examples

These samples illustrate the use of PATH mode in generating XML from a SELECT query. Many of these queries are specified against the bicycle manufacturing instructions XML documents that are stored in the Instructions column of the ProductModel table.

See also