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.
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.
SARGable Date Filters: Stop Wrapping Columns in Functions
Write SARGable date filters as half-open ranges for years, months, days, and rolling windows, then compare plans and logical reads.






