Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I'm not sure how to query this XML file in order to get the "arrival date" and "arrival quantity" if they appear.This query is wrong:
quote:
DECLARE @xml XMLSELECT @xml = x.y FROM OPENROWSET (BULK 'C:\files\stock.xml',SINGLE_BLOB) as x(y)SELECT x.y.value('ID[1]','varchar(15)'), x.y.value('QUANTITY[1]','int'), x.y.value('ARRIVAL/DATE[1]','int'), x.y.value('ARRIVAL/QUANTITY[1]','int'), 'tr'FROM @xml.nodes('STOCK/PRODUCTS/PRODUCT') x(y)
Thanks in advance.
James K
Master Smack Fu Yak Hacker
3873 Posts
Posted - 2014-04-08 : 09:03:44
The only thing I see wrong with it is that you need brackets like shown below. Or, are you looking for output in some other format? Can you have multiple arrival nodes within a single product node?