Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ftsoft
Starting Member
22 Posts |
Posted - 2009-11-06 : 12:10:57
|
| In the code below, I get 2 rows generated, but the second row has the same value as the first (105 instead of 115). Can anyone help with this.the relevant xml- <DATA_RECORD>- <E01><E01_01>2009128</E01_01><E01_02>FTSoft</E01_02><E01_03>Tipp City IRS</E01_03><E01_04>V01.1</E01_04></E01>- <E02><E02_01>55-027</E02_01><E02_04>30</E02_04><E02_05>75</E02_05><E02_06>105</E02_06><E02_06>115</E02_06><E02_07>150</E02_07><E02_08>225</E02_08><E02_09>290</E02_09><E02_10>360</E02_10><E02_12>303</E02_12><E02_20>390</E02_20></E02>snipthe SPALTER PROCEDURE [dbo].[OpenXMLTest](@newRun Varchar(8000),@id VARCHAR(10))ASBEGINDECLARE @index intDECLARE @ParentID intSELECT @ParentID=pk_E01 FROM E01 Where E01_01=@idEXEC sp_xml_preparedocument @index OUTPUT, @newRunUPDATE E02SET E02_01=xmlTable.E02_01, E02_04=xmlTable.E02_04, E02_05=xmlTable.E02_05,E02_12=xmlTable.E02_12, E02_20=xmlTable.E02_20FROM OPENXML(@index, 'DATA_RECORD/E02',2)WITH (E02_01 VARCHAR(7), E02_04 INT, E02_05 INT, E02_12 VARCHAR(15), E02_20 INT)xmlTableWHERE E02.pk_E01 = @ParentIDINSERT INTO E02_06(fk_E01,E02_06)SELECT @ParentID,E02_06FROM OPENXML(@index, 'DATA_RECORD/E02',2)WITH (E02_06 INT)ENDThanks |
|
|
|
|
|
|
|