Comma delimited RRS feed

  • Question

  • User1812645854 posted


     I am using the following query in SSRS report

     Select c.Name, SUBSTRING( (SELECT ( ', ' + o.OrderId) FROM dbo.Orders o WHERE o.CustomerId = c.CustomerId FOR XML PATH('') ), 3, 1000) AS Col1 From Customers c

    When I am using the above query in SSRS report, the results are like below for the Col1:

    <Expr1>, 1234 </Expr1>

    <Expr1>, 1234, 321, 456 </Expr1>

    Here my requirement is I want to display all orders of a customer as comma delimited string, but when I execute the above Sql statement in Sqlserver management studio it is displaying fine like the below:


    1234, 321, 456.

    I am wondering why it is displaying as <expr1> in report.


    Wednesday, March 7, 2012 12:02 PM