hi every one

my problem is is to convert id column values as comma separated

ex: id
1
2
3
4
5
6
i want result set as string "1,2,3,4,5,6,7....."

Look up group_concat: select group_concat(id) from <yourtablenamehere> group by ''

Look up group_concat: select group_concat(id) from <yourtablenamehere> group by ''

it is not working for primary key column

Yes it is. Have a close look at my example, especially the group clause.
If it does not work for you, show your table definition and the code.

i got the result by following statement :

select group_Concat(convert(id,char)) as idKey from users

thanks for spending time

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.