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
Five crochet hooks in olive, blue, cream, blue and red stand in a row, with the red hook tallest

ANY and ALL: Comparing a Value to a Whole Subquery in T-SQL

August 22, 2011
Pinal Dave
SQL Tips and Tricks
SQL NULL, SQL Operator, SQL Sub Query, Temp Table

One missing price is enough to make ALL return nothing while ANY returns rows. Here is how to see it, and how to ask the question more safely.

Read More
Three LIKE symbols shown as cards: percent sign, underscore and open bracket, each with the number of rows that contain it next to the number of rows LIKE found, and a row of plain symbols whose counts matched

Special Characters in a LIKE Pattern: Which Ones Are Wildcards

August 2, 2011
Pinal Dave
SQL Tips and Tricks
SQL Operator, SQL Scripts, SQL Search, SQL String

Special characters in a LIKE pattern can match the wrong rows, because three symbols mean more than themselves. This post tests every common symbol on one small table. It shows how to search for a percent sign, an underscore and a bracket, and why a space in the pattern counts.

Read More
Four LIKE wildcards with a real example each: percent matches Baker and Brooks for B percent, underscore finds Baker, Patel and Taylor for underscore a percent, [A-K] returns five names, and [^A-K] returns nine

Wildcard Basics in SQL Server: How LIKE Patterns Work

August 1, 2011
Pinal Dave
SQL Tips and Tricks
SQL Operator, SQL Scripts, SQL Search, SQL String

Wildcard basics for SQL Server: how LIKE works with %, _, sets and ranges, shown on one small table of last names. It also covers the mistakes with equal signs and sets, case and accents in ranges, and matching a wildcard literally. Every result comes from SQL Server 2025.

Read More
Error dialog explaining why a query does not throw an error.

SQL SERVER – Puzzle Involving NULL – Resolve – Error – Operand data type void type is invalid for sum operator

June 27, 2011
Pinal Dave
SQL Puzzle
SQL NULL, SQL Operator, SQL Scripts, SQL Server

SELECT SUM over a lone NULL throws Msg 8117: Operand data type void type is invalid for sum operator. Here is why it happens and how ISNULL fixes it.

Read More
Gouache painting of one jar of buttons being topped up by a small red scoop while spare empty jars stand unused

Compound Assignment Operators in T-SQL with Simple Examples

June 5, 2008
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Operator, SQL Scripts

Compound Assignment Operators let T-SQL do a calculation and an assignment in one step, so SET @Stock -= 2 replaces SET @Stock = @Stock – 2. This post tests all eight operators on SQL Server 2025 with a small garden center inventory. It also shows integer division, NULL, string and flag examples, and where the shorthand does not help.

Read More
SQL SERVER - 2005 Comparison EXCEPT operator vs. NOT IN

SQL SERVER – 2005 Comparison EXCEPT operator vs. NOT IN

May 22, 2007
Pinal Dave
SQL Tips and Tricks
SQL Index, SQL Operator, SQL Scripts, SQL Server

The EXCEPT operator returns distinct rows from the left query with no match on the right, just like NOT IN. Both give the same plan, but EXCEPT reads simpler.

Read More
Previous 1 … 4 5 6 7
  • Books
  • Testimonials
  • Privacy Policy

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