Posts tonen met het label CTE. Alle posts tonen
Posts tonen met het label CTE. Alle posts tonen

maandag 11 januari 2010

How to generate the English Alphabet in SQL

Picked this sweet piece of code from one the questions in SQL Server Central.

WITH Alpha as

(
   SELECT  Distinct Top 26 EnglishAlpha = CHAR(ABS(CHECKSUM(NEWID()))%26+65)
   From Master.sys.SysColumns t1, Master.sys.SysColumns t2
)
SELECT EnlishAlpha
FROM Alpha
ORDER BY EnglishAlpha