Above is my output after executing the query but i want to to separated row means multiple row splitting the taskid column by ' , '.
After so many searches and some modification i able to create a query which is very helpful for me -
SELECT
Split.a.value('.', 'VARCHAR(100)') AS taskid, A.invoiceid,A.Rate
FROM (SELECT
CAST ('<M>' + REPLACE([taskids], ',', '</M><M>') + '</M>' AS XML) AS String , [invoiceid],[Rate]
FROM SMOInvoiceHistory) AS A CROSS APPLY String.nodes ('/M') AS Split(a)
Happy Coding...........
No comments:
Post a Comment