• Another variation from Lynn's version:

    ;with

    a1 as (

    select 1 as N union all select 1 union all select 1 union all select 1 union all

    select 1 union all select 1 union all select 1 union all select 1

    ),

    cteRandomString as (

    select

    substring('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',(abs(checksum(newid()))%36)+1,1)

    as RandomString

    from

    ( select 1 as N from a1 as a cross join a1 as b ) a

    )

    select

    convert(varchar(64),replace((

    select

    ','+RandomString

    from

    cteRandomString

    for xml path (''))

    ,',','')) as RandomString;