Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 21st, 2007, 09:05 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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!

Reply With Quote
  #2 (permalink)  
Old July 8th, 2008, 03:40 AM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You should use FOR XML EXPLICIT if you intend to generate CDATA sections.

Jacob Sebastian SQL Server MVP www.sqlserverandxml.com www.sqlkatmai.com
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
XML vs SQL Server 2005 yadavrahul2k5 XML 2 June 1st, 2008 03:59 AM
Transform SQL server 2005 XML with xslt bonekrusher XSLT 0 July 11th, 2007 08:45 PM
Looping through XML in SQL Server 2005 francislang SQL Server 2005 1 February 23rd, 2006 11:47 AM
Achitecture ? SQL -> XML -> ASP -> PDF or HTML Frm jstrong Classic ASP XML 0 July 9th, 2005 02:18 PM
XML to (different <tag>) XML mapping Thodoris XML 4 April 27th, 2004 05:02 AM



All times are GMT -4. The time now is 10:24 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.