Click here to Skip to main content
14,217,717 members
Rate this:
Please Sign up or sign in to vote.
See more:
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
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100