hi,
i have a table called names and field name
select * from names
name
a
b
c
d
i want to display like this
name
a,b,c,d
how it is possible
Regards
Baiju
Answer Posted / soorai ganesh
Hi Friend,
If u use SQLSERVER 2005 u can try like this............
CREATE TABLE EMP ( ENAME VARCHAR(25))
INSERT INTO EMP VALUES('Ganesh')
INSERT INTO EMP VALUES('Narendra')
INSERT INTO EMP VALUES('Rinku')
INSERT INTO EMP VALUES('Selvam')
INSERT INTO EMP VALUES('Kirti')
SELECT REPLACE(REPLACE(
( SELECT ENAME AS EmpName FROM EMP FOR XML PATH ('') ) ,'<EmpName>',''),'</EmpName>',',')
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What keyword you will use to get schema appended to the result set of a ‘for xml’ query?
What is BLOCK statements in SQL?
What is the difference between left and right outer join?
Explain the properties of sub-query in sql server?
What are the differences between INNER JOIN, LEFT JOIN and RIGHT JOIN in SQL Server?
What is transaction server explicit transaction?
Are connections to sql server encrypted?
Which tcp/ip port does sql server run on? How can it be changed?
Explain the various types of concurrency problem. I.e. Lost or buried updates, uncommitted dependency, inconsistent analysis, phantom read?
Explain the steps needed to create a scheduled job?
How can we check the sql server version?
Where are SQL server users names and passwords are stored in sql server?
Explain the different types of joins?
What is difference between equi join and inner join?
If you lose rights to your sql server instance what are the options to connect to sql server instance? : sql server security