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
A diagram of order statuses: New, Paid, Packed, Shipped and Delivered in a row, Cancelled below, and a red dashed arrow from New to Shipped marked as rejected with Msg 50001 and the text Status change not allowed: order 4 New to Shipped

State Machine in T-SQL: Allowed Status Changes for an Order

July 22, 2013
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Scripts, SQL Transactions, SQL Trigger

A state machine in T-SQL keeps the allowed status changes in a table and rejects every other change. This post builds one for orders with a transitions table and a trigger, then tests a bad jump, several rows in one UPDATE, new orders, a transaction and a new rule. Every result comes from SQL Server 2025.

Read More
Gouache painting of queued cards behind a wooden gate beside an hourglass and an output tray.

WAITFOR DELAY in SQL Server: SQL in Sixty Seconds #055

July 17, 2013
Pinal Dave
SQL Video
SQL in Sixty Seconds, SQL Lock, SQL Scripts, SQL Wait Stats

WAITFOR DELAY pauses a SQL Server batch for a fixed amount of time. This episode shows the command, and the tests here measure how long it really waits, what it does to locks and workers, and where it stops being the right tool.

Read More
Gouache illustration for INNER JOIN: two matching oak corners use the same fitted joint construction.

INNER JOIN vs JOIN in SQL Server: Is There Any Difference?

July 16, 2013
Pinal Dave
SQL Tips and Tricks
SQL Joins, SQL Operator, SQL Scripts, SQL Server

INNER JOIN vs JOIN is a question about one optional keyword. The tests here show identical results, identical query and plan hashes, the one place where INNER is required, and the LEFT JOIN trap that really does change the rows.

Read More
Gouache painting of a book lying open on a wooden desk, thin grey copy sheets beneath its blank pages and one vermilion sheet at the edge

Change Data Capture Cost: Log, Storage and Cleanup Measured

July 10, 2013
Pinal Dave
SQL Performance
SQL Log, SQL Performance, SQL Scripts

Change Data Capture cost shows up in places a quick setup never checks. On SQL Server 2025, the same update wrote three times the log with CDC on, the log waited for the capture, and the change table grew to almost four times the table. Here is every number and the script that produced it.

Read More
Two twin lambs in a field, a hand parting the wool on one to reveal a small red mark

Comparing Two Copies of a Table With CHECKSUM_AGG and HASHBYTES

June 24, 2013
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Migration, SQL Scripts, SQL Server

Use CHECKSUM_AGG for a quick table-copy signal, then compare canonical HASHBYTES values and key ranges to locate real data differences.

Read More
Two plain handheld magnifying glasses rest beside a small closed notebook on a desk.

What to Look For in a SQL Client Tool

June 18, 2013
Pinal Dave
SQL Tips and Tricks
Best Practices, Database, SQL Scripts, SQL Server

Choose a SQL client tool by testing result handling, execution plans, transactions, and connection identity before trusting it with real work.

Read More
A mousetrap style bar switch on a doorframe connected by a taut wire to a small brass bell

What Is a Trigger in SQL Server?

June 17, 2013
Pinal Dave
SQL Tips and Tricks
Best Practices, Database, SQL Scripts, SQL Server

A trigger in SQL Server runs because something else happened, and you never call it. The inserted and deleted tables, why it fires once per statement and not once per row, and when to reach for something else.

Read More
Previous 1 … 185 186 187 188 189 190 191 … 363 Next
  • Books
  • Testimonials
  • Privacy Policy

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