|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: |
/* Create sample table. */
Declare @BookBags Table
([TransactionId] [int] NOT NULL,
[BookBag] [xml] NOT NULL)
/* Insert sample values */
Insert Into @BookBags (TransactionId, Bookbag)
Select 1, '<Bookbag> <Book Id="1" Name="SQL"/> <Book Id="2" Name="C#"/> </Bookbag>'
Insert Into @BookBags (TransactionId, Bookbag)
Select 2, '<Bookbag> <Book Id="1" Name="Java"/> <Book Id="2" Name="SQL"/> </Bookbag>'
/* Bad Example of how to via XML variable (which is not desired!).
Problems:
A: XML variable holds only one table record. Need both records.
B: Want to select from table, not XML variable.
C: Need TransactionId from table.
*/
Declare @BookBagXML Xml
Select @BookBagXML = BookBag From @BookBags
Select
[TransactionId] = 'I need this value from the table'
,[Book_Id] = x.Book.value('@Id[1]', 'int')
,[Book_Name] = x.Book.value('@Name[1]', 'varchar(100)')
From @BookBagXML.nodes('/Bookbag/Book') As x ( Book )
|
Advertisement
| Hall of Fame |