A reader asked how to get a single random number for a set of rows, like one per PostalCode. I compare NEWID() for each row with RAND() for a whole set.
SQL SERVER – Remove Duplicate Entry from Comma Delimited String – UDF
A simple UDF from reader Ashish Jain that removes duplicate entries from a comma delimited string by turning it into a table and using DISTINCT.
SQL SERVER – Find Number of Rows and Disk Space Reserved – Using sp_spaceused Interesting Observation
sp_spaceused shows the row count of a table and the disk space reserved. Here is why its numbers looked wrong on AdventureWorks and how @updateusage fixed them.
Percent Change Between Rows: Handling Zero and NULL Safely
One zero month can kill a revenue report. Here is how to get percent change without errors or lies.
TIMEFROMPARTS: Fraction Values Follow the Precision
TIMEFROMPARTS builds a time from separate components. The same fractions argument means milliseconds at precision three and much smaller units at precision seven.
ATAN: Understand the Principal Angle of a Ratio
ATAN converts a tangent ratio into a principal angle. The sign and selected interval matter, and a ratio alone cannot recover every original directional quadrant.
Running Start Times: Build an Agenda With SQL
Running start times depend on the durations that precede each activity. Use ordered window sums while retaining full dates and explicit end boundaries.







