views:

424

answers:

1

I have the following table in my database:

CREATE TABLE [dbo].[XmlData](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [xmldata] [xml] NOT NULL,
CONSTRAINT [PK_XmlData] PRIMARY KEY CLUSTERED 
(
    [id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

And when I run the following INSERT and SELECT statements I can see that my CDATA sections are being stripped somewhere along the line.

INSERT 
    INTO 
        [XmlCdataTest].[dbo].[XmlData] ([xmldata])
    VALUES
        ('<doc><control><value><![CDATA[10 < 11]]></value></control></doc>')
GO

SELECT [xmldata] FROM XmlData
GO

Is this some sort of bug in SQL 2005 or is there some option I can use to tell SQL Server to not strip these cdata sections from my xml data?

+1  A: 

It appears that there is no way around this.

Sean Bright