Sunday, March 25, 2012

Data set towards a chain of character

Hello :

I have a request which me dismissal 10 lines (normal select), I want to have quite lines in a single chain of character, separated one in the others by a comma:

A
B
C
D > A,B,C,D

What is that you have an idea for ca.

Thank you.

If you use SQL Server 2005,

Code Snippet

Declare @.data table (val char);

Insert Into @.data

Select 'A'

Union All

Select 'B'

Union All

Select 'C'

Union All

Select 'D'

Select

Substring((Select ',' + val as [text()] from @.data for xml path('')),2,8000)

|||Thank's , but i use oracle !!!

|||

Oracle?

Ok, I believe except SQL Server none of the DB provide such a easy way to covert the result-set into XML (For XML clause). But oracle do have the xml output – you can try to get the answer on oracle forums. But I can provide few hints (what I remember still), XMLElement, XMLAttributes, XMLForest these are the XML generator functions in Oracle.

No comments:

Post a Comment