Most people ask how to keep leading zeros in SQL Server. This time a reader wanted to remove leading zeros and white space from a column, so here is a script.
SQL SERVER – Retrieving Random Rows from Table Using NEWID()
Two quick ways to pull random rows from table data in SQL Server: ORDER BY NEWID() or CHECKSUM(NEWID()) with TOP, plus a 60 second video.
Storing UTC and Local Time Side by Side
Store UTC and local time consistently, preserve offsets, handle daylight saving changes, and filter timestamps with clear boundaries.
Window Functions Over GROUP BY Results: SUM of SUM Explained
Why does SUM(SUM(Amount)) OVER () work? Because the window runs after GROUP BY. A short demo with shares, ranks and a filter trap.
SQL SERVER – Function to Round Up Time to Nearest Minute Interval
A small T-SQL function that rounds a datetime up or down to the nearest minute interval you pass in, with the code and how to call it.
SQL SERVER – Find First Non-Numeric Character from String
No built-in function finds the first non-numeric character in a string, so I use PATINDEX. Here is a quick script with sample data you can try.
Cleaning Address Data in T-SQL: Trimming, Casing and Standardizing
Start cleaning address data with preserved originals, normalized spaces, careful casing, street-word mappings, and postal-code review flags.






