Sample Header Ad - 728x90

Rolling up multiple varbinary(max) rows into a single row

1 vote
1 answer
218 views
My table looks something like this: |BinFiles| |--------| |0x1101ABB1C...| |0x2202DEE2F...| |0x3303GHH3I...| I tried this to get a single line:
SELECT
    STUFF((SELECT d.BinFiles
    FROM dbo.demo d
    WHERE d.ID = dd.ID
    FOR XML PATH('')), 1, 1, '') BinFiles
FROM
	dbo.demo dd
How can I do this? Or is this possible for varbinary data (size issues)? I'm using SQLServer 2019. The varbinary columns are part of a pdf file (1Mb per file). I need to join these columns into a single row for export again as a pdf file.
Asked by mbielsa (66 rep)
Sep 12, 2023, 08:47 AM
Last activity: Sep 27, 2023, 07:04 AM