1

I have a table Student with a column studentStateinfo which consist of XML value as below.

<params xmlns="">
  <OldStudentID>1aedghe1d8ef</OldStudentID>
</params>

Now when I query this table Student I only want to check whether studentStateinfo column have an XML data with tag <OldStudentID>

1 Answer 1

1

Use the exist() Method (xml Data Type)

Example using a variable, you should change that to a column instead.

declare @X xml = '
<params xmlns="">
  <OldStudentID>1aedghe1d8ef</OldStudentID>
</params>';

select @X.exist('/params/OldStudentID');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.