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
Gouache painting of a wooden ticket inspection station checking outer shape and matching slots in two separate stages.

Validate a Date With Regex in SQL Server 2025: Shape Is Not Enough

December 12, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Server, SQL String

To validate a date with regex in SQL Server 2025, pair REGEXP_LIKE with TRY_CONVERT. The tests here show impossible dates that pass a strict pattern, spellings that convert but break the format, and how to enforce both checks with a constraint.

Read More
A row of wooden toy animals with the repeats set aside in a basket below.

Removing Repeated Characters From a String With GENERATE_SERIES

December 8, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Server, SQL Server 2022, SQL String

Remove repeated characters with GENERATE_SERIES, ROW_NUMBER, and ordered STRING_AGG, then benchmark a SQL Server 2019 fallback.

Read More
Gouache painting of three colored ribbons feeding through a brass guide and joining into one braided cord.

Concat Strings in SQL Server: SQL in Sixty Seconds #035

December 5, 2012
Pinal Dave
SQL Video
SQL in Sixty Seconds, SQL NULL, SQL Scripts, SQL String

To concat strings in SQL Server, use the + operator or the CONCAT function. The tests here show what each one does with NULL, numbers and dates, how the 8000 character limit cuts a result, and when CONCAT_WS or STRING_AGG is the better tool.

Read More
Hands sewing cloth bunting whose cord has run out, two red flags side by side.

STRING_AGG Limits: The 8,000 Byte Error, Ordering and Duplicates

December 1, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Server, SQL String, SQL XML

Fix STRING_AGG 8,000-byte limits, enforce ordering, remove duplicates before aggregation, and compare its timing with XML.

Read More
Gouache painting of two shelves holding the same three jars in opposite orders, the short jar on the top shelf painted red

Display Datetime in a Specific Format: CONVERT and FORMAT

November 21, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL String

To display datetime in a specific format, use CONVERT with a style number or FORMAT with a pattern. This post tests both on a fixed value, shows the lowercase pattern mistake, measures how much slower FORMAT is, and explains why parsing text dates needs a style.

Read More
SQL SERVER - Order By Numeric Values Formatted as String

SQL SERVER – Order By Numeric Values Formatted as String

October 23, 2012
Pinal Dave
SQL Tips and Tricks
SQL Server, SQL String

A column holds alphanumeric values that start with a number, and ORDER BY sorts them as text. Here is how to sort the rows by the Numeric part instead.

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
Previous 1 … 9 10 11 12 13 14 15 … 23 Next
  • Books
  • Testimonials
  • Privacy Policy

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