Monday, 3 June 2013

Many Rows Cells merge in one cells in SQL

(select REPLACE (replace(SUBSTRING((select distinct ',',RTRIM(LTRIM(p.EmplID))
from tb_tab_Employee_code p where p.EmplID in (select s.EmployeeID from tb_tab_OthereEmployeeInvoled s where
 s.EmployeeReportId=id)
 for xml path('')),2,200000),'<EmplID>',''),'</EmplID>','')) as [Other Involed EmployeeID]

No comments:

Post a Comment