Concatenating Binary Rows

  • Hi guys, I read this link and I have exactly the same problem:

    http://www.sqlservercentral.com/Forums/Topic613703-338-1.aspx

    But the solution doesn't work for me! I got a type as table:

    CREATE TYPE [dbo].[User_Ven_Att] AS TABLE(

    [userName] [bigint] NULL,

    [idNasVendor] [bigint] NULL,

    [srvAtt] [varbinary](max) NULL

    )

    I fill it but see a different result (I used the solution in the above link):

    DECLARE @TBL AS User_Ven_Att

    INSERT INTO @TBL

    SELECT 1000006409, 1, 0x1A0900000009FC03FF UNION ALL

    SELECT 1000006409, 1, 0x1A0900000009FC03FF UNION ALL

    SELECT 1000115634, 1, 0x1A0900000009FC03FF UNION ALL

    SELECT 1000115634, 1, 0x1A0900000009FC03FF

    select A.userName, cast(cast((select cast(srvAtt as varchar(max))

    from @TBL B

    where B.userName = A.userName

    for xml path('')) as varchar) as varbinary) as all_data

    from (select distinct userName from @TBL) as A

    The output is something wrong!

    10000064090x26237831413B0926237830303B26237830303B26237830303B09FC262378

    10001156340x26237831413B0926237830303B26237830303B26237830303B09FC262378

    Why? What should I do?

    Any idea I appreciate in advance.

  • Duplicate thread, answer in this thread

    😎

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply