This code shows the Symbol and HEX as well as DEC. Still to go is OCT.
WITH Symbols AS ( SELECT -1 code, CHAR(ASCII(' ')) Symbol UNION ALL SELECT code + 1, CHAR(code + 1) FROM Symbols WHERE code + 1 <= 255 ) SELECT Symbol, ASCII(Symbol) AS [DEC], master.dbo.fn_varbintohexstr(CAST(Symbol AS VARBINARY)) AS HEX --,(ASCII(Symbol) % 8) AS [OCT] FROM Symbols ORDER BY [DEC] OPTION (MAXRECURSION 256)