The following SQL Server query will generate a list of characters for the first 65,536 code points in collation order. For illustration purposes, a WHERE
clause has been added to show only those code points that lie within the printable ASCII range:
WITH
n AS (
SELECT 0 AS n
UNION ALL SELECT n + 1 FROM n WHERE n < 65536
)
, c AS (
SELECT n AS codePoint, NCHAR(n) AS char FROM n
)
, coll AS (
SELECT *, ROW_NUMBER() OVER (ORDER BY char, codePoint) AS seq FROM c
)
SELECT
*
FROM coll
WHERE codePoint BETWEEN 32 AND 126
ORDER BY seq
OPTION (MAXRECURSION 0)