When exporting data to Excel the character “&” is being shown as “&”. This is done by the button “Exporteren” in the toolbar of the Windows GUI.

Can this be fixed please?
When exporting data to Excel the character “&” is being shown as “&”. This is done by the button “Exporteren” in the toolbar of the Windows GUI.
Can this be fixed please?
Best answer by Anne Buit
Hi Johan,
This does resolve the problem with the ampersand. However, you might run into a few more problems with other characters being escaped, such as greater-than and lower-than.
The following solution would prevent any xml escaping from ending up in the final text:
STUFF(
(SELECT x.y.value('.', 'NVARCHAR(MAX)')
FROM (
SELECT ', ' + x.naam
FROM oplosser o
JOIN organisatie x ON x.guid = o.organisatie_guid
WHERE o.melding_guid = t1.guid
ORDER BY x.naam
FOR XML PATH (''), type
) x(y)
), 1 , 2 , '')
Edited: casing of .value
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.