|
So, say I have an xml field with the following blob of xml in it
and lets say that I have a product info table that has more information about products such as table ProductInfo ProductID, Info ________________________________ 123, "Has a good warranty" 123, "Comes in the color blue" 456, "Is a favorite of many people" 456, "Will be discontinued soon" So, how could I join that table in and produce the following Has a good warranty Comes in the color blue Is a favorite of many people Will be discontinued soon furthermore, it would be also cool to pull in some attributes from the product table itself ProductTable ID, Name 123, "Product abc" 456, "Product foobar" and then finally produce this Has a good warranty Comes in the color blue Is a favorite of many people Will be discontinued soon Any thoughts / suggestions are much appreciated and welcome! thanks, -Matt
(comments are locked)
|
|
Here is an example which might help: This will result in the following xml shape: While this is not exactly the shape you requested, it is a good start. The mix of values and attributes in the final result typically requires restating the select statement for xml explicit. Please let me know if you want me to adjust the shape. Oleg
(comments are locked)
|


From what you describe, you are asking to produce invalid xml. This is because your product node refers to different things. On one hand, you want to have a product node (one per record), on the other hand you have productinfo table which might have multiple records per product. Thus you should probably opt to name the node containing product info different (for example name it productinfo, without the space). Your xml will then look like this: Has a good warrantyComes in the color blue. If this is acceptable, I can answer your question a little bit later. Please let me know.