在Sql表中插入Xml值 [英] Insert the Xml Values in Sql Table
本文介绍了在Sql表中插入Xml值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hai我想在这里将Xml值插入到Sql表中我正在编写我的代码,但我没有选择值,请你帮我解决这个问题
Hai i want to insert the Xml Values in to the Sql table here i am writing my code but i am not selecting the values can u please help me out in this
declare @XmlValue xml;
Set @XmlValue ='<?xml version="1.0"?>
<ArrayOfETemplateConditions>
<eTemplateConditions>
<ConditionId>50</ConditionId>
<TemplateId>26</TemplateId>
<IsDefault>true</IsDefault>
<ConditionName>Header</ConditionName>
<Region>H</Region>
<Status>1</Status>
<Sequence>1</Sequence>
<Description />
<IsInternal>false</IsInternal>
<SampleStatusMapId>0</SampleStatusMapId>
</eTemplateConditions>
<eTemplateConditions>
<ConditionId>53</ConditionId>
<TemplateId>26</TemplateId>
<IsDefault>true</IsDefault>
<ConditionName>footer</ConditionName>
<Region>F</Region>
<Status>1</Status>
<Sequence>3</Sequence>
<Description />
<IsInternal>false</IsInternal>
<SampleStatusMapId>0</SampleStatusMapId>
</eTemplateConditions>
</ArrayOfETemplateConditions>
'
EXEC SP_XML_PREPAREDOCUMENT @docHandle OUTPUT, @XmlValue
Select TemplateId,ConditionName,Description,Region,Status,Sequence,GETDATE(),IsDefault,IsInternal
FROM OPENXML (@docHandle,'/ArrayOfETemplateConditions/eTemplateConditions',2)
With(TemplateId varchar(50),ConditionName varchar(50),Description varchar(200),Region VARCHAR(10),[Status] INT,Sequence INT,
IsDefault bit,IsInternal bit)
先谢谢
Thanks in Advance
推荐答案
查看这些链接。
http:// stackoverflow .com / questions / 21378729 / how-to-insert-xml-data-into-sql-server-table [ ^ ]
HTTP://www.developer。 COM / db / article.php / 3755106 /使用XML-Data-Type-of-SQL-Server.htm [ ^ ]
http://zarez.net/?p=2631 [ ^ ]
Check these links.
http://stackoverflow.com/questions/21378729/how-to-insert-xml-data-into-sql-server-table[^]
http://www.developer.com/db/article.php/3755106/Working-with-the-XML-Data-Type-of-SQL-Server.htm[^]
http://zarez.net/?p=2631[^]
这篇关于在Sql表中插入Xml值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文