QUERY to create a string from 0 to 9999

WITH x AS (
SELECT n FROM (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) v (n)
)
SELECT ones.n + 10 * tens.n + 100 * hundreds.n + 1000 * thousands.n
FROM x ones, x tens, x hundreds, x thousands
ORDER BY 1

 1,470 Total Visualizações,  1 Visualizações Hoje

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.