[已解决]无法将数据插入具有XML类型列的表中 [英] [Solved]Unable to insert data into a table having a XML type column

查看:61
本文介绍了[已解决]无法将数据插入具有XML类型列的表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计,



我陷入了一种奇怪的境地。

我有一张桌子,只有2根柱子。以下是架构:

  CREATE   TABLE  [dbo]。[StandardView](
[ViewName] [ varchar ]( 50 NULL
[Fields] [xml] NULL
ON [ PRIMARY ]





我必须在上表中插入一行。

我使用下面的插入声明:

 插入  dbo.StandardView ' 标准',N '  <?xml version =1.0encoding =utf-16standalone =yes?>< FieldName>名称,EmpName&地址,名称< / FieldName& gt;'



< FieldName>标签是由我给出的,它没有任何意义。

当我执行上面的插入语句时,我得到以下错误:

Msg 9421,Level 16 ,状态1,第1行

XML解析:第1行,字符236,非法名称字符




我甚至尝试转换在插入XML列之前,但没有白费。

专家,请在这里协助我哪里出错。

帮助或指针将受到高度赞赏。



-Regards

Anurag

解决方案

看看下面的链接。



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


这篇关于[已解决]无法将数据插入具有XML类型列的表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆