Reputation: 109
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 .
Upvotes: 1
Views: 51
Reputation: 754268
How about
SELECT
ID, [Status], [Load]
FROM
dbo.YourTableNameHEre
WHERE
Load.value('(/root/Loan)[1]', 'int') = 1004
Upvotes: 3