To get comma separated list in SQL as well as in MDX use below queries.
1 – SQL
Select Name from Sales.SalesReason
GO
Select Name from Sales.SalesReason
SELECT
SUBSTRING
(
(
SELECT
‘,’ + s.Name
FROM
Sales.SalesReason s
ORDER BY
s.Name
FOR XML PATH(”)
)
,2,200000 ) AS NAME
2 – MDX
WITH
SET [COMMA] AS [Sales Reason].[Sales Reasons].[Sales Reason].MEMBERS
MEMBER [MEASURES].[COMMATEST] AS
Generate
(
[COMMA],[COMMA].CurrentMember.Name
,”,”
)
SELECT
NON EMPTY
{
[MEASURES].[COMMATEST]} ON 0
FROM
[ADVENTURE WORKS];
Regards
Suhas Kudekar
Like us on FaceBook | Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook
Follow me on Twitter | Follow me on FaceBook
Nice.