Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Alpicus
Starting Member
2 Posts |
Posted - 2007-10-18 : 08:15:34
|
| Hi,When I execute the following script on SQL Server 2005 SP2 :IF EXISTS (select * from sys.objects where name = 'TEXTEST2' and type_desc = 'USER_TABLE')BEGINDROP TABLE TEST.TEXTEST2ENDCREATE TABLE TEST.TEXTEST2( ARR XML);INSERT INTO TEST.TEXTEST2 (arr) VALUES ('<?xml version=''1.0'' encoding=''windows-1252''?><E0><E01 LT=''C''><![CDATA[L''échéancier & env.ASP]]></E01><E02 LT=''C''><![CDATA["Tools" --> "Terminkalender"]]></E02></E0>');The result in the XML field (ARR) is :<E0><E01 LT="C">L'échéancier & env.ASP</E01><E02 LT="C">"Tools" --> "Terminkalender"</E02></E0>Why the CDATA section is gone ?Thanks in advance.Phil MermodPensia Ltd - R&D - CTOwww.pensia.com |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-10-18 : 08:29:36
|
| they are removed in parse time. it's how it worksif you must preserve then use nvarchar(max)_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
Alpicus
Starting Member
2 Posts |
Posted - 2007-10-18 : 08:40:06
|
| Hi spirit1,The objective of XML CDATA section is to keep the contents without any changes (Check the doc. : http://www.w3.org/TR/xml/#sec-cdata-sect)Is there a way to have an XML field keeping the CDATA contents ?TIA.Phil MermodPensia Ltd - R&D - CTOwww.pensia.com |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-10-18 : 09:00:09
|
i know that declare @xml xml set @xml = '<node><![CDATA[123 > 111]]></node>' select @xml, datalength(@xml) _______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
|
|
|