Skip to content

Instantly share code, notes, and snippets.

@ststeiger
Created November 13, 2014 13:25
Show Gist options
  • Select an option

  • Save ststeiger/c897c1ae17df17cfbdc3 to your computer and use it in GitHub Desktop.

Select an option

Save ststeiger/c897c1ae17df17cfbdc3 to your computer and use it in GitHub Desktop.
SELECT the ASCII-chart in SQL
;
WITH CTE AS
(
SELECT
0 AS num
,CAST(null AS varchar(100)) AS chr
UNION ALL
SELECT
CTE.num + 1 AS num
,CAST(CHAR(CTE.num) AS varchar(100)) AS chr
FROM CTE
WHERE cte.num < 255
)
SELECT * FROM CTE
OPTION (MAXRECURSION 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment