• BWAA-HAA!!! Frosty needs to get a set-based decoder ring! 😛

    DECLARE @ToAllGoodPeople TABLE

    (

    RowNum INT,

    Cypher VARCHAR(100)

    )

    INSERT INTO @ToAllGoodPeople

    (RowNum, Cypher)

    SELECT 1,'8.1.16.16.25.27.2.9.18.20.8.4.1.25' UNION ALL

    SELECT 2,'1.14.4.27.7.15.15.4.23.9.12.12' UNION ALL

    SELECT 3,'20.15.27.1.12.12'

    SELECT REPLACE((SELECT CHAR(SUBSTRING('.'+p2.Cypher,N+1,CHARINDEX('.',p2.Cypher+'.',N)-N)+64)

    FROM dbo.Tally t

    CROSS JOIN @ToAllGoodPeople p2

    WHERE p1.RowNum = p2.RowNum

    AND t.N <= LEN(p2.Cypher)+1

    AND SUBSTRING('.'+p2.Cypher,t.N,1) = '.'

    ORDER BY t.N

    FOR XML PATH(''))

    ,'[',' ')

    FROM @ToAllGoodPeople p1

    GROUP BY p1.RowNum

    ORDER BY p1.RowNum

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)