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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 openxml

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2007-04-26 : 05:09:25
<marketData>
<date>10-jan-2001</date>
<producedBy>person1</producedBy>
<SpotRates>
<SpotRate code="USDCAD">
<values>
<value type="BID">1.1276</value>
<value type="ASK">1.1277</value>
<value type="MID">1.127649997783</value>
</values>
</SpotRate>
<SpotRate code="EURUSD">
<values>
<value type="BID">1.3607</value>
<value type="ASK">1.3608</value>
<value type="MID">1.36075</value>
</values>
</SpotRate>
<SpotRate code="GBPUSD">
<values>
<value type="BID">2.0025</value>
<value type="ASK">2.0027</value>
<value type="MID">2.0026</value>
</values>
</SpotRate>
</SpotRates>
</marketData>

-------------------------------------------
How can I modify the sql below so that I can also insert SpotRate code from the xml data above?

insert into tblSpotRates
(
SpotRateCode
BID,
ASK,
MID

)
select
?
Bid,
Ask,
Mid
FROM OPENXML (@idoc, '/marketData/SpotRates/SpotRate/values',2)
WITH (
Bid varchar(50) 'value[1]',
Ask varchar(50) 'value[2]',
Mid varchar(50) 'value[3]'
)
   

- Advertisement -