Empid Empname Salary
1 Ram 15000
2 Ramesh 20000
3 Ravi 25000
4 Sam 30000
5 Ganesh 35000
i want to display Empname in single cell separated with space.
i want the output as follows Empname in single cell
Ram Ramesh Ravi Sam Ganesh.
for that how to write the query in sql server.
1 Ram 15000
2 Ramesh 20000
3 Ravi 25000
4 Sam 30000
5 Ganesh 35000
i want to display Empname in single cell separated with space.
i want the output as follows Empname in single cell
Ram Ramesh Ravi Sam Ganesh.
for that how to write the query in sql server.
Dharmraj ThakurPosted May 16, 2017, 12:35 AM
SELECT
STUFF(
(
SELECT ' '+ EmpName from Employee FOR XML PATH('')
),1,1,'') as Employees
Abhinav AbhishekPosted May 15, 2017, 12:59 PM