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
Several hands reaching into a crate of oranges, each taking a different one, one hand passing over a held orange.

UPDLOCK and READPAST for Queue Tables

April 22, 2013
Pinal Dave
SQL Tips and Tricks
Query Hint, SQL Lock, SQL Server, SQL Transactions

UPDLOCK and READPAST let SQL Server queue workers claim different rows safely when transactions, retries, and completion rules are designed.

Read More
A hand holding a bunch of grass stems by a campfire, one short stem with a red tip just drawn out

Picking Random Winners Fairly With NEWID and CRYPT_GEN_RANDOM

December 14, 2012
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Random, SQL Server, SQL Transactions

Pick random winners with NEWID or cryptographic randomness, handle weights and unique entrants, and save a draw with its seed and timestamp.

Read More
Gouache painting: a round wooden storehouse lined with a ring of grain bins, every bin empty and swept ready to refill except one whose small door is held shut by a vermilion latch

log_reuse_wait_desc: Why the Transaction Log Will Not Shrink

December 7, 2012
Pinal Dave
SQL Tips and Tricks
SQL Backup and Restore, SQL Server DBCC, SQL Transactions, Transaction Log

log_reuse_wait_desc tells you why SQL Server cannot reuse its transaction log, so you know why a shrink gives nothing back. This post causes LOG_BACKUP and ACTIVE_TRANSACTION on purpose in a test database on SQL Server 2025, measures the log and fixes each one.

Read More
Punch needle beside a continuous stitched row with its last loose loop withdrawn

Gapless Invoice Numbers That Restart Every Year

October 25, 2012
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL Transactions

Finance hates a missing invoice number. A small counter table and one short transaction keep the numbers gapless and restart them each year.

Read More
A sparrow leaving a birdbath taken by a big pigeon, flying toward a puddle beside a red tulip

SET LOCK_TIMEOUT and Error 1222: Waiting Less for Locks

September 13, 2012
Pinal Dave
SQL Performance
SQL Error Messages, SQL Lock, SQL Server, SQL Transactions

Set LOCK_TIMEOUT to bound lock waits, reproduce error 1222, clean up the transaction, and retry safely without confusing client timeouts.

Read More
Gouache painting of three streams of paper cards merging through wooden channels into an organized output tray.

Insert Multiple Rows in SQL Server: SQL in Sixty Seconds #024

August 29, 2012
Pinal Dave
SQL Video
SQL in Sixty Seconds, SQL Scripts, SQL Table Operation, SQL Transactions

To insert multiple rows in SQL Server, use separate INSERT statements, UNION ALL or one VALUES list. The tests here compare all three on SQL Server 2025, including failures, the 1,000 row limit and the time for 1,000 rows.

Read More
A red high-jump bar hanging at a slant, one end still on its peg and the other on the landing mat

XACT_ABORT: Why a Half-Done Transaction Can Survive an Error

June 26, 2012
Pinal Dave
SQL Tips and Tricks
SQL Error Messages, SQL Server, SQL Stored Procedure, SQL Transactions

Use XACT_ABORT to prevent partial writes, inspect transaction state after an error, and build a TRY CATCH pattern with reliable rollback.

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

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