Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 0.71 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <ITEMS><ITEM SEQ="0" INDNO="50814" DRN="N00230000004816012012" CR_GUID="FB64CD73-8048-4775-81F2-969AE2AB442C" DR_GUID="8025D121-E3B6-4479-A393-CDDC5BEB53C0" CR_ACC="" DR_ACC="" AMOUNT="0" DATE="20120202" /></ITEMS>
  2.        
  3. create table YourTable
  4. (
  5.   XMLColumn xml
  6. )
  7.  
  8. insert into YourTable values
  9. ('<ITEMS><ITEM SEQ="0" INDNO="50814" DRN="N00230000004816012012" CR_GUID="FB64CD73-8048-4775-81F2-969AE2AB442C" DR_GUID="8025D121-E3B6-4479-A393-CDDC5BEB53C0" CR_ACC="" DR_ACC="" AMOUNT="0" DATE="20120202" /></ITEMS>')
  10.        
  11. select I.N.value('@DRN', 'varchar(50)') as DRN
  12. from YourTable as T
  13.   cross apply T.XMLColumn.nodes('/ITEMS/ITEM') as I(N)
  14.        
  15. |                   DRN |
  16. -------------------------
  17. | N00230000004816012012 |