سؤال

So I've got an xml field in my DB.

Sometimes what I'm doing fails and I get the following in my field:

<errorMessage>No response received!</errorMessage>

How do I query my DB to return all rows where the xml field contains an errorMessage XML?

So something like

SELECT * FROM
TABLE
WHERE xml IsOfType 'errorMessage'

I think I need to use exists but the syntax is eluding me.

هل كانت مفيدة؟

المحلول

figured it out

SELECT TOP 100 * FROM dbo.TABLE with (nolock)
WHERE Response.exist('/errorMessage') = 1
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top