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
Tangled fishing flies lie beside matching flies secured individually in a foam fly wallet

Large IN Lists: When a Temp Table Beats Thousands of Values

August 1, 2011
Pinal Dave
SQL Tips and Tricks
Primary Key, SQL Performance, SQL Sub Query, Temp Table

Pasting thousands of IDs into an IN list works, until it does not. See where the time goes and how to keep the answer the same with a temp table.

Read More
A hand holds one cloth napkin free of a metal holder while the remaining stack stays inside

Destructive Reads: Pulling Work From a Queue Table With OUTPUT

June 10, 2011
Pinal Dave
SQL Tips and Tricks
Output Clause, SQL Delete, SQL Transactions, Temp Table

Claiming a job and finishing it are two different things. Try a delete claim, a rollback, and an update claim on a tiny queue.

Read More
A jigsaw puzzle with pieces sorted into groups before being fitted together

Common Table Expressions for Readability

April 20, 2011
Pinal Dave
SQL Tips and Tricks
CTE, SQL Coding Standards, SQL Server, Temp Table

Common table expressions for readability name query steps and support recursion, but they do not promise cached intermediate results.

Read More
SQL SERVER - How to Drop Temp Table - Check Existence of Temp Table

SQL SERVER – How to Drop Temp Table – Check Existence of Temp Table

May 17, 2009
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL TempDB, Temp Table

Readers often ask how to check existence of a temp table and how to drop temp table without Msg 2714. My earlier article answers all of these questions.

Read More
A hand lifts the last dark log from an old firewood bay into a canvas bag already holding dark logs and one pale log.

FIFO Inventory Costing in T-SQL: Matching Sales to Purchase Lots

April 1, 2009
Pinal Dave
SQL Tips and Tricks
Ranking Functions, SQL Joins, SQL Scripts, Temp Table

Which purchase lot paid for which sale? Two running totals and one join answer it, with no cursor and no loop.

Read More
An open brass cash drawer holds undisturbed coin stacks as a shop shutter is lowered.

End-of-Day Balances From a Transaction Table

March 11, 2009
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Scripts, Temp Table

A transaction table stores movements, not balances. Collapse each day, run a total, fill the quiet days and dodge the midnight trap.

Read More
Previous 1 … 6 7 8 9 10 Next
  • Books
  • Testimonials
  • Privacy Policy

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