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.
| Author |
Topic |
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-02-22 : 05:14:55
|
| decalre @date xmlset @xml = '<PurchaseOrderInformation> <PurchaseOrderNumber>4500022378</PurchaseOrderNumber> <PurchaseOrderIssuedDate> <Date> <Year>2006</Year> <Month>12</Month> <Day>8</Day> </Date> </PurchaseOrderIssuedDate> <PurchaseOrderReference PurchaseOrderReferenceType="TransactionID" >1</PurchaseOrderReference> <PurchaseOrderReference PurchaseOrderReferenceType="TransactionID">2</PurchaseOrderReference> <PurchaseOrderReference PurchaseOrderReferenceType="CustomerSpecificationNumber" >3</PurchaseOrderReference></PurchaseOrderInformation>'How can i get the value in PurchaseOrderReference where PurchaseOrderReferenceType="TransactionID"ie i got output values 1 and 2 values.using value method iam not getting the correct result.please help. It's Urgent. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-22 : 06:30:05
|
Try like this:-SELECTPurchaseOrderReference.Type.value('./[@PurchaseOrderReferenceType]','VARCHAR(50)')FROM @xml.nodes('/PurchaseOrderInformation/PurchaseOrderReference') as PurchaseOrderReference(Type) |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-02-22 : 07:29:47
|
| yes, I got the Correct Result Thank u so much. |
 |
|
|
|
|
|