Top "For-xml" questions

Replace “&lt;” and “&gt;” with “<” and “>” in sql server

Hi I am new to for xml I have a query like this SELECT ProjectId, ProjectCode, ProjectName, TechId, -- LocationId, ( …

sql-server for-xml for-xml-path
Using CHAR(13) in a FOR XML SELECT

I'm trying to use CHAR(13) to force a new line, but the problem is, I'm doing this within a FOR …

sql sql-server-2008 tsql for-xml
SQL FOR XML - Outputting data as Elements or as Attributes

I'm trying to export some data from a database in a particular XML format specified by the customer. The XML …

sql xml tsql xslt for-xml
FOR XML PATH in Sql Server

NOTE: I have solved the majority of this problem but have run into a snag. Read to the bottom please. …

sql-server for-xml
TSQL: One Row Per Element With FOR XML

I have a SQL Server 2005 query that generates a large result set (up to several gigabytes): SELECT * FROM Product FOR …

tsql for-xml
SQL Server EXPLICIT mode with FOR XML

I am using SQL Server 2008 and I'm trying to produce a custom xml using EXPLICIT mode with FOR XML. I …

sql-server-2008 tsql for-xml for-xml-explicit
How can I use a WITH XMLNAMESPACES clause with correlated queries?

I'm trying to use the FOR XML feature of SQL Server to generate some XML, with some specific namespaces. My …

sql-server for-xml
Cast FOR XML to Varchar(max)

I have a query that returns XML which I want to convert to varchar. My query returns 93,643 characters of XML. …

sql-server xml ssms for-xml
How to use FOR XML in Subqueries?

I'd like to return the below xml: <ResultDetails> <Node1>hello</Node1> <Sites> &…

sql sql-server xml for-xml
CTE and FOR XML to generate nested XML

I have an adjacency list in the DB and want to deliver the data in XML format to the client …

sql-server xml tsql common-table-expression for-xml