I need to remove the xml-tags from the nested sql statement:
SELECT STUFF(
(
SELECT Mailbox
FROM dbo.Mailbox
WHERE UnitGroup IN (
SELECT a.Groups
FROM (
SELECT DISTINCT ID, GroupFC AS Groups
FROM dbo.v_Pending
UNION ALL
SELECT DISTINCT ID, GroupBN AS Groups
FROM dbo.v_Pending
UNION ALL
SELECT DISTINCT ID, GroupRM AS Groups
FROM dbo.v_Pending
) AS a
WHERE a.Groups IS NOT NULL
AND a.ID = 12345
)
FOR XML PATH('')
), 1, 0, ''
) AS Mails
I tried it with the statement FOR XML PATH('') but it doesn't work. Maybe someone knows the error. I always get the xml-tags -.-
Currently result looks like this:
<Mailbox>[email protected];</Mailbox>
<Mailbox>[email protected];</Mailbox>