Pick random winners with NEWID or cryptographic randomness, handle weights and unique entrants, and save a draw with its seed and timestamp.
Removing Repeated Characters From a String With GENERATE_SERIES
Remove repeated characters with GENERATE_SERIES, ROW_NUMBER, and ordered STRING_AGG, then benchmark a SQL Server 2019 fallback.
STRING_AGG Limits: The 8,000 Byte Error, Ordering and Duplicates
Fix STRING_AGG 8,000-byte limits, enforce ordering, remove duplicates before aggregation, and compare its timing with XML.
The WINDOW Clause: Name a Window Once and Reuse It
Use the WINDOW clause to reuse partition and order rules, extend named windows with frames, and keep SQL Server calculations consistent.
SQL SERVER – Find Weekend and Weekdays from Datetime in SQL Server 2012
Is today a weekend or a weekday? A question from the very first SQL Bangalore User Group meeting, answered with the CHOOSE function in SQL Server 2012.
SQL SERVER – Removing Leading Zeros From Column in Table – Part 2
Part 2 on removing leading zeros from column values: readers improved my sample with all-zero values and shared better methods, collected here.
SQL SERVER – Using RAND() in User Defined Functions (UDF)
Using RAND() in a user defined function throws Msg 443, invalid use of a side-effecting operator. Here is a simple workaround that lets a UDF use a random value.







