enrique_aeo
asked on
XML: replace value of - why is not working
i have this xml
<InvoiceList xmlns="http://schemas.adventure-works.com/Invoices">
<Invoice InvoiceNo="1000">
<Customer>Kim Abercrombie</Customer>
<Items>
<Item Product="1" Price="1.99" Quantity="2" />
<Item Product="3" Price="2.49" Quantity="1" />
</Items>
</Invoice>
<Invoice InvoiceNo="1001">
<Customer>Sean Chai</Customer>
<Items>
<Item Product="1" Price="2.45" Quantity="2" />
</Items>
</Invoice>
</InvoiceList>
why is not working
UPDATE #Stores
SET Invoices.modify('declare default element namespace "http://schemas.adventure-works.com/Invoices";
replace value of (/InvoiceList/Invoice/Item s[@Price=" 1.99"]/@Pr ice)[1]
with "1.69"')
WHERE StoreID = 1
<InvoiceList xmlns="http://schemas.adventure-works.com/Invoices">
<Invoice InvoiceNo="1000">
<Customer>Kim Abercrombie</Customer>
<Items>
<Item Product="1" Price="1.99" Quantity="2" />
<Item Product="3" Price="2.49" Quantity="1" />
</Items>
</Invoice>
<Invoice InvoiceNo="1001">
<Customer>Sean Chai</Customer>
<Items>
<Item Product="1" Price="2.45" Quantity="2" />
</Items>
</Invoice>
</InvoiceList>
why is not working
UPDATE #Stores
SET Invoices.modify('declare default element namespace "http://schemas.adventure-works.com/Invoices";
replace value of (/InvoiceList/Invoice/Item
with "1.69"')
WHERE StoreID = 1
There isn't any 'StoreID' value in the xml you posted tho your query is using it to define specific data.
ASKER
it is exits
XML-storeID.jpg
XML-storeID.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.