This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
SQL SERVER - Removing Leading Zeros From Column in Table

SQL SERVER – Removing Leading Zeros From Column in Table

November 19, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server

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.

Read More
Table and toolbar.

SQL SERVER – Retrieving Random Rows from Table Using NEWID()

November 16, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function

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.

Read More
Two identical cottages side by side, one in midday sun and one at night

Storing UTC and Local Time Side by Side

November 13, 2012
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL DateTime, SQL Function, SQL Server

Store UTC and local time consistently, preserve offsets, handle daylight saving changes, and filter timestamps with clear boundaries.

Read More
SQL SERVER - Function to Round Up Time to Nearest Minute Interval

SQL SERVER – Function to Round Up Time to Nearest Minute Interval

November 2, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

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.

Read More
SQL SERVER - Find First Non-Numeric Character from String

SQL SERVER – Find First Non-Numeric Character from String

October 14, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL 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.

Read More
Hands squaring a neat stack of plain envelopes beside a messy pile, a red rubber band around the tidy stack

Cleaning Address Data in T-SQL: Trimming, Casing and Standardizing

October 12, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server, SQL String

Start cleaning address data with preserved originals, normalized spaces, careful casing, street-word mappings, and postal-code review flags.

Read More
A gardener lifting white frost covers one by one along a vegetable row on a frosty morning.

SARGable Date Filters: Stop Wrapping Columns in Functions

October 5, 2012
Pinal Dave
SQL Performance
SQL DateTime, SQL Function, SQL Index, SQL Performance, SQL Server

Write SARGable date filters as half-open ranges for years, months, days, and rolling windows, then compare plans and logical reads.

Read More
Previous 1 … 30 31 32 33 34 35 36 … 61 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com