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
how you can get the list of largest tables in a database? : Sql server administration
When to use Inner join & when to use subquery?
What is inline table-value user-defined function?
What are the types of lock supported by ?
How to insert a new row into a table with "insert into" statements in ms sql server?
How to generate create table script on an existing table in ms sql server?
What are the restrictions that views have to follow? : SQL Server Architecture
what is the information that can be stored inside a bit column? : Sql server database administration
How to list all objects in a given schema?
How is sql used in sql server?
What is use of dbcc commands?
What is log ldf?
How to add code to the existing article (using improve article)?
Explain an incremental backup?
What is not null constraint?