‹ BackHN Continuity

Thread

Small programming tricks

681 points · 294 comments · signa11

  1. adzm · · focus · HN ↗
    My favorite is generating a sequential resultset of the numbers 1-4096 in SQL Server with this simple query:

    ;with [[[]][[[](_)as(select 1 union select 0),[[]][]][](_)as(select 1 from [[[]][[[] []]]][]]],[[[]][[[] _),[]][]][[](_)as(select 1 from [[]][]][] []]]][]]],[[]][]][] _),[[[[[]][](_)as(select 1 from []][]][[] []]]][]]],[]][]][[] _),[[[]][]]](_)as(select 1 from [[[[[]][] []]]][]]],[[[[[]][] _)select _ from(select row_number()over (order by _)from [[[]][]]])[[[]][[[](_);

    /s

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.