SQL Server Performance Forum – Threads Archive
XML question – how now?
Hi all – it’s me (again! [:I]).<br /><br />I’m trying to get my head around handling XML data, and specifically trying to find elements, and enchance XML received.<br /><br />At a high-level description, I need to handle an XML file, join to a SQL resultset, and then insert an element into the XML, and write/update the source XML file.<br /><br />here’s a brief sample of the XML data:<br />’<?xml version="1.0" encoding="UTF-8"?><br /><!DOCTYPE RECORDS SYSTEM "records.dtd"><br /><RECORDS><br /> <RECORD><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineID"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>34699</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="Hierarchy"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>DVDs</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_NewBadger"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>New Value 1</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="New Navigable Dimension"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>TEST1</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineID"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>34699</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Year"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>1992</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Wine"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>A Red Blend Alexander Valley</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Winery"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Lyeth</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_PriceStr"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>18.00</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Score"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>5</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Region"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sonoma</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_DateReviewed"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>08/31/95</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType1"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Red</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Year2"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>1992</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType2"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Cabernet Blend</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_URLString"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>LYETH Cabernet Blend Alexander Valley A Red Blend 1992 Cabernet Blend Red</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Description"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Supple and polished cedar, coffee, cherry and berry flavors. This is elegant, finishing with firm tannins and good length. Drinkable now.</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Berry</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Cedar</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Cherry</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Coffee</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Elegant</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Firm</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Firm Tannins</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL><img src=’/communi ty/emoticons/emotion-4.gif’ alt=’;P’ />olished</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Supple</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Tannins</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Appellations"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Alexander Valley</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Appellations"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sonoma</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Name"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>A Red Blend Alexander Valley</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Price"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>18.00</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Red</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Cabernet Blend</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Berry</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Cedar</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Cherry</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Coffee</PVAL><br /> </PROP><br /> </RECORD><br /> <RECORD><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineID"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>34700</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="Hierarchy"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>DVDs</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_NewBadger"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>New Value 2</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="New Navigable Dimension"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>TEST1</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineID"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>34700</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Year"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>1992</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Wine"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>A Tribute White Sonoma Mountain</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Winery"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Benziger</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_PriceStr"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>16.00</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Score"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>15</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Region"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sonoma</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_DateReviewed"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>08/31/95</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType1"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>White</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Year2"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>1992</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType2"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sauvignon Blend</PVAL><br /> </PROP& gt;<br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_URLString"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>BENZIGER Sauvignon Blend Sonoma Mountain A Tribute 1992 Sauvignon Blend White</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Description"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Crisp in texture, nicely harmonious in the way in weaves its spicy, toasty-onion nuances through the fig and lemon fruit. Ready now. (200 cases produced)</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Fig</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Fruit</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Lemon</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Toasty</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Crisp</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Harmonious</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Appellations"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sonoma</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Appellations"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sonoma Mountain</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Name"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>A Tribute White Sonoma Mountain</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Price"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>16.00</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>White</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sauvignon Blend</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Fig</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Fruit</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Lemon</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Toasty</PVAL><br /> </PROP><br /> </RECORD><br /> </RECORDS>'<br /><br />I need to find the <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineID">, and use the related PVAL – for example 34699 and 34700 to join with a resultset that will look something like:<br />34699,’Available'<br />34700,’UnAvailable'<br /><br />Then I need to insert a new element into the <RECORD> node, being:<br /><<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Availability"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>"Available"</PVAL><br /></PROP><br /><br />I’m grappling with OPENXML or XQUERY etc., to find a way to query the values.<br /><br />the BOL sample:<br />DECLARE @x xml<br />SET @x = ‘<ROOT><a>111</a></ROOT>'<br />SELECT @x.query(‘/ROOT/a’)<br /><br />returns:<br />111<br /><br />That seems to be what I would need to do, but I have issues with:<br /><br />I declare @X xml, and set it = sample XML above.<br /><br />SELECT @x.query(‘/RECORDS/RECORD/PROP NAME="P_WineID"/pval’)<br />returns ERROR:<br />Msg 2209, Level 16, State 1, Line 221<br />XQuery [query()]: Syntax error near ‘PROP'<br /><br />SELECT @x.query(‘/RECORDS/RECORD/P_WineID/pval’)<br />returns what seems null or an emtpy string:<br />XML DTD has been stripped from one or more XML fragments. External subsets, if any, have been ignored.<br /><br />———————————————…(truncated this line)<br /><br /><br />(1 row(s) affected)<br /><br />SELECT @x.query(‘/RECORDS/RECORD/PROP/pval’)<br />returns same as SELECT @x.query(‘/RECORDS/RECORD/P_WineID/pval’)<br /><br />SELECT @x.query(‘/RECORDS/RECORD/PROP="P_WineId"/pval’)<br />returns ERROR<br />Msg 2374, Level 16, State 1, Line 221<br />XQuery [query()]: A node or set of nodes is required for /<br /><br />….<br /><br />Am I beyond help here? How do I identify the element <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineID"> so I can get the PVAL ?<br /><br />Panic, Chaos, Disorder … my work here is done –unknownHave you checked the web for any reference, may refer tohttp://www.microsoft.com/technet/prodtechnol/sql/2000/reskit/part9/c3161.mspx for any help. Satya SKJ
Microsoft SQL Server MVP
Contributing Editor & Forums Moderator
http://www.SQL-Server-Performance.Com
This posting is provided �AS IS� with no rights for the sake of knowledge sharing.
Some progress made, but I still won’t claim to understand it yet.<br /><br />I’m a little worried that, because of the structure of the XML I’m getting, it is going to be difficult to get handle it – if yoy notice the XML I gave above, there are duplicate sets, like :<br /><pre id="code"><font face="courier" size="2" id="code"><br /><<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />rop Name="P_WineID"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>36799</pval><br /></prop><br /></font id="code"></pre id="code"><br />which appears twice in the 1st <RECORD> node. I’m hoping to tryt and find out if thsat is a mistake in the XML sample I was given.<br /><br />In the meantime, the code I have is:<br /><br /><pre id="code"><font face="courier" size="2" id="code"><br />set nocount on<br /><br />DECLARE <br />@idocint,<br />@TPNBint,<br />@docvarchar(8000)<br /><br />DECLARE <br />@XMLDocumentTable TABLE<br />(AttNAmevarchar(50),<br />PVALvarchar(500))<br /><br />SET @doc =’<?xml version="1.0" encoding="UTF-8"?><br /><!DOCTYPE RECORDS SYSTEM "records.dtd"><br /><RECORDS><br /> <RECORD><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineID"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>34699</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="Hierarchy"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>DVDs</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_NewBadger"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>New Value 1</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="New Navigable Dimension"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>TEST1</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineID"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>34699</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Year"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>1992</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Wine"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>A Red Blend Alexander Valley</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Winery"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Lyeth</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_PriceStr"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>18.00</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Score"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>5</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Region"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sonoma</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_DateReviewed"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>08/31/95</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType1"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Red</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Year2"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>1992</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType2"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Cabernet Blend</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_URLString"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>LYETH Cabernet Blend Alexander Valley A Red Blend 1992 Cabernet Blend Red</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Description"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Supple and polished cedar, coffee, cherry and berry flavors. This is elegant, finishing with firm tannins and good length. Drinkable now.</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Berry</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Cedar</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Cherry</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Coffee</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/communit y/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Elegant</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Firm</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Firm Tannins</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL><img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />olished</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Supple</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Tannins</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Appellations"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Alexander Valley</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Appellations"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sonoma</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Name"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>A Red Blend Alexander Valley</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Price"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>18.00</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Red</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Cabernet Blend</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Berry</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Cedar</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Cherry</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Coffee</PVAL><br /> </PROP><br /> </RECORD><br /> <RECORD><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineID"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>34700</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="Hierarchy"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>DVDs</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_NewBadger"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>New Value 2</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="New Navigable Dimension"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>TEST1</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineID"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>34700</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Year"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>1992</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Wine"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>A Tribute White Sonoma Mountain</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Winery"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Benziger</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_PriceStr"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>16.00</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Score"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>15</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Region"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sonoma</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_DateReviewed"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>08/31 /95</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType1"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>White</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Year2"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>1992</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType2"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sauvignon Blend</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_URLString"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>BENZIGER Sauvignon Blend Sonoma Mountain A Tribute 1992 Sauvignon Blend White</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Description"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Crisp in texture, nicely harmonious in the way in weaves its spicy, toasty-onion nuances through the fig and lemon fruit. Ready now. (200 cases produced)</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Fig</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Fruit</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Lemon</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavors"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Toasty</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Crisp</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Body"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Harmonious</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Appellations"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sonoma</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Appellations"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sonoma Mountain</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Name"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>A Tribute White Sonoma Mountain</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Price"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>16.00</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>White</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_WineType"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Sauvignon Blend</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Fig</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Fruit</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Lemon</PVAL><br /> </PROP><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />ROP NAME="P_Flavor"><br /> <<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />VAL>Toasty</PVAL><br /> </PROP><br /> </RECORD><br /> </RECORDS>'<br />–Create an internal representation of the XML document.<br />EXEC sp_xml_preparedocument @idoc OUTPUT, @doc<br />– Execute a SELECT statement that uses the OPENXML rowset provider.<br />INSERT @XMLDocumentTable (AttNAme, PVAL)<br />SELECT<br />[email protected] = PVAL<br />[Name], PVAL<br />–*<br />FROM<br />OPENXML (@idoc, ‘/RECORDS/RECORD/PROP’,3)<br />WITH (<br />[NAME]varchar(50)’@Name’,<br />PVALvarchar(500)’./PVAL’)<br /><br />SELECT AttNAme,PVAL FROM @XMLDocumentTable<br /></font id="code"></pre id="code"><br /><br />This gives me the RESULTS<br /><pre id="code"><font face="courier" size="2" id="code"><br />AttNAme PVAL<br />————————————————– —————————————————<br />NULL 34699<br />NULL DVDs<br />NULL New Value 1<br />NULL TEST1<br />NULL 34699<br />NULL 1992<br />NULL A Red Blend Alexander Valley<br / >NULL Lyeth<br />NULL 18.00<br />NULL 5<br />NULL Sonoma<br />NULL 08/31/95<br />NULL Red<br />NULL 1992<br />NULL Cabernet Blend<br />NULL LYETH Cabernet Blend Alexander Valley A Red Blend 1992 Cabernet Blend Red<br />NULL Supple and polished cedar, coffee, cherry and berry flavors. This is elegant, finishing with firm tannins and good length. Drinkable now.<br />NULL Berry<br />NULL Cedar<br />NULL Cherry<br />NULL Coffee<br />NULL Elegant<br />NULL Firm<br />NULL Firm Tannins<br />NULL Polished<br />NULL Supple<br />NULL Tannins<br />NULL Alexander Valley<br />NULL Sonoma<br />NULL A Red Blend Alexander Valley<br />NULL 18.00<br />NULL Red<br />NULL Cabernet Blend<br />NULL Berry<br />NULL Cedar<br />NULL Cherry<br />NULL Coffee<br />NULL 34700<br />NULL DVDs<br />NULL New Value 2<br />NULL TEST1<br />NULL 34700<br />NULL 1992<br />NULL A Tribute White Sonoma Mountain<br />NULL Benziger<br />NULL 16.00<br />NULL 15<br />NULL Sonoma<br />NULL 08/31/95<br />NULL White<br />NULL 1992<br />NULL Sauvignon Blend<br />NULL BENZIGER Sauvignon Blend Sonoma Mountain A Tribute 1992 Sauvignon Blend White<br />NULL Crisp in texture, nicely harmonious in the way in weaves its spicy, toasty-onion nuances through the fig and lemon fruit. Ready now. (200 cases produced)<br />NULL Fig<br />NULL Fruit<br />NULL Lemon<br />NULL Toasty<br />NULL Crisp<br />NULL Harmonious<br />NULL Sonoma<br />NULL Sonoma Mountain<br />NULL A Tribute White Sonoma Mountain<br />NULL 16.00<br />NULL White<br />NULL Sauvignon Blend<br />NULL Fig<br />NULL Fruit<br />NULL Lemon<br />NULL Toasty<br /></font id="code"></pre id="code"><br /><br />I just need to try and figure out how to put the NAME values into the AttName…<br /><br />Any ideas?<br /><br />Panic, Chaos, Disorder … my work here is done –unknown
£$%!£$%!£^$ so – XML is case sensitive. I changed @Name to @NAME, and now it works…. *sighs* the walls around here all seem to have a dent that is consistent with my shape of my forehead Panic, Chaos, Disorder … my work here is done –unknown
]]>