Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

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


Comments

Posted by Anonymous on 3 April 2010

Pingback from  Twitter Trackbacks for                 SQL Server Central, A T-SQL Holiday Message - Never Say Never         [sqlservercentral.com]        on Topsy.com

Leave a Comment

Please register or log in to leave a comment.