且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

[已解决]无法将数据插入具有XML类型列的表中

更新时间:2023-11-30 21:15:04

看看下面的链接。



http://social.msdn.microsoft.com/Forums/sqlserver/en-US/b548216c-fa54-45aa-a4b3-7f2df3bce187/xml-parsing-illegal-name-字符

Hi Folks,

I landed in a weird situation.
I have a table, with just 2 columns. Below is the schema:

CREATE TABLE [dbo].[StandardView](
    [ViewName] [varchar](50) NULL,
    [Fields] [xml] NULL
) ON [PRIMARY]



I gotta insert a row in the above table.
I am using the below Insert Statement:

insert into dbo.StandardView values('Standard',N'<?xml version="1.0" encoding="utf-16" standalone="yes"?><FieldName>Name, EmpName & Address, Designation</FieldName>')


<FieldName> tag is given by me, it does not have any significance.
While I execute the above insert statement I get the below error:
Msg 9421, Level 16, State 1, Line 1
XML parsing: line 1, character 236, illegal name character


I even tried Convert before the XML column while inserting, but to no vain.
Experts, please assist here as to where am I going wrong.
Help or pointer will be highly appreciated.

-Regards
Anurag

Have a look at below link.

http://social.msdn.microsoft.com/Forums/sqlserver/en-US/b548216c-fa54-45aa-a4b3-7f2df3bce187/xml-parsing-illegal-name-character