Blog Post

A T-SQL Holiday Message

,

Totally pointless, but fun.  Run it to decode the message.

DECLARE @Message varchar(20)
SET @Message = '????????????'

DECLARE @Decode Table(
DSeq tinyint,
DKey smallint
)

INSERT INTO @Decode(DSeq, DKey)
VALUES(1,9),(2,2),(3,17),(4,17),(5,26),(6,6),(7,2),(8,20),(9,21),(10,6),(11,19)

; WITH
Decoder AS (
SELECT D.DSeq N,
CHAR( D.DKey + ASCII(SUBSTRING(@Message,D.DSeq,1)) ) DV
FROM @Decode D),
Conc (S) AS (
SELECT DV + ''
FROM Decoder D
ORDER BY D.N
FOR XML PATH(''))

SELECT STUFF(S,6,0,' ') [Surprise]
FROM Conc

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating