1
ID  Status  LOAD
1   Active  <root><Loan>1001</Loan><Atty>False</Atty></root>
2   Failed  <root><Loan>1021</Loan><Atty>True</Atty></root>
3   Failed  <root><Loan>1004</Loan><Atty>True</Atty></root>
4   Active  <root><Loan>1034</Loan><Atty>True</Atty></root>

Here , I want to get the status ,ID and LOAD where loan number =1004. How do we can create sql query ? Load column is XML type .

1 Answer 1

3

How about

SELECT
    ID, [Status], [Load]
FROM
    dbo.YourTableNameHEre
WHERE
    Load.value('(/root/Loan)[1]', 'int') = 1004
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.