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
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
bonnie
April 6, 2010 at 8:15 pm
I got a syntax error?
Seth Phelabaum
April 6, 2010 at 8:22 pm
The Value inserts are using 2008 specific syntax. I thought about using 2000 syntax but it was ugly.