| In this example we will aplit column with comma and add one primary column with it we can also do join with this.
Below is the table wher we need to split data and column
Below is the out put we need for this
SELECT AutoId,
LTRIM(RTRIM(m.n.value('.[1]','varchar(8000)'))) AS WorkOrderNo
FROM
(
SELECT AutoId,CAST('' + REPLACE(WorkorderNo,',','') + '' AS XML) AS x
FROM tbl_IPRMainStatusChangeHistory where autoid in(10099,10100)
)t
CROSS APPLY x.nodes('/XMLRoot/RowData')m(n)
| | |