SQL 2005 Xpath query help needed
Posted on 2009-07-08
I need some help with making a query with a SQL 2005 XML column.
I have a table called EventLog, and this table has a column Details that is of type XML and contains details about an event log entry. Different event log entries may have different details. The XML for some of the entries looks like this:
This one has two elements, UserID and InvoiceID, and their respective values.
What I need to do is to write a SQL query that will return * FROM EventLog WHERE the Details column has a InvoiceID element and its value is N (e.g. 123). This way I can find all event log entries that are somehow related to invoice 123.
Thanks in advance!