This project has moved and is read-only. For the latest updates, please go here.
1
Vote

Issue with /

description

Just tried the aggregate function. but when using GROUP_CONCAT_D(columnname,'<br/>')

its omitting the values after '/'

eg:

1<br/2<br/3<br/4

Hope you can recreate the issue.


Regards
Biju

comments

opcthree wrote Apr 11, 2016 at 3:37 AM

The signature for the Aggregate is:

dbo.GROUP_CONCAT_D( @Value (NVARCHAR(4000), No Default), @Delimiter (NVARCHAR(4), No Default))

In other words, '<br/' is all the aggregate will accept as a delimiter. If you have needs beyond it, then you can use a sentinel value that would not likely appear in your data as your delimiter and replace it after, like this:
DECLARE @Delimiter NVARCHAR(4) = N'|~~|';

SELECT  DocID,
        REPLACE(dbo.GROUP_CONCAT_D(ErrorDetail, @Delimiter), 
                @Delimiter, 
                N'<br/>')
FROM    dbo.GroupConcatTestData
GROUP BY DocID;