|
|
 |
| SQL Server 2005 General discussion of SQL Server *2005* version only. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Server 2005 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

February 21st, 2007, 09:05 AM
|
|
Registered User
|
|
Join Date: Feb 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
SQL Server 2005 XML: FOR XML PATH -> cdata?
Hello,
Is it possible to output a column as cdata when using xml path?
For example:
Code:
SELECT CustomerID as "@CustomerID",
CompanyName,
Address as "address/street",
City as "address/city",
Region as "address/region",
PostalCode as "address/zip",
Country as "address/country",
ContactName as "contact/name",
ContactTitle as "contact/title",
Phone as "contact/phone",
Fax as "contact/fax"
FROM Customers
FOR XML PATH('Customer'), ROOT('doc')
Is there a way to output street address as cdata? Right now I'm using FOR XML EXPLICIT to output cdata, but my query is getting quite complicated and I would like to switch to the path method.
Thanks!
|

July 8th, 2008, 03:40 AM
|
|
Registered User
|
|
Join Date: Jul 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You should use FOR XML EXPLICIT if you intend to generate CDATA sections.
Jacob Sebastian SQL Server MVP www.sqlserverandxml.com www.sqlkatmai.com
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |