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
Two side by side cartoon panels in a children's magazine style, one child at a keyboard with a mess of tangled cables, the other at a tidy desk, no faces shown.

T-SQL Mistakes: Careless and Careful Write the Same Six Queries

October 26, 2026
Pinal Dave
SQL Tips and Tricks
SQL Cursor, SQL Function, SQL NULL, SQL Performance, SQL Scripts

T-SQL mistakes, in the two-panel format the children’s magazines used. Careless writes it one way. Careful writes it the other. Every pair was run on the same 1,200,000 rows on SQL Server 2025 and measured. One pair returned a wrong answer. One I stopped after fourteen minutes of CPU.

Read More
Overutilized

SQL SERVER – Exploring 3 Overutilized Features

November 17, 2023
Pinal Dave
SQL Tips and Tricks
Query Hint, SQL Cursor

Potentially leading to less efficient implementations or missed opportunities for optimization. In this blog post, we’ll explore three such Overutilized features.

Read More
cursorsetbased

SQL SERVER – Convert Cursor to Set Based Insert

July 6, 2023
Pinal Dave
SQL Tips and Tricks
SQL Cursor

In this blog post, we will focus on the issue of cursor-based inserts and demonstrate how to convert them into set based operations.

Read More
common table expression

SQL SERVER – Replacing a Cursor with a Common Table Expression

July 3, 2023
Pinal Dave
SQL Performance
CTE, SQL Cursor, SQL String

Let us learn today – How I was able to improve the query performance by replacing the cursor with a common table expression (CTE).

Read More
Gouache painting of a long pegboard on a table with pliers, a saw, two vermilion-handled hammers, one set crosswise out of line

Performance Tuning Mistakes in SQL Server: 11 Habits to Fix

February 1, 2023
Pinal Dave
SQL Performance
Best Practices, SQL Backup and Restore, SQL Cursor, SQL Index, SQL Statistics

Performance tuning mistakes are habits, and each one has a check. Eleven sit in one table, and five are measured on a demo database: a missing index, stale statistics, a row by row loop, a giant delete and a type that cannot be indexed.

Read More
Gouache painting of a row of cream parcels each with a small brass bell on top, one parcel wrapped in vermilion

NOCOUNT Performance: What SET NOCOUNT ON Saves in a Loop

December 18, 2019
Pinal Dave
SQL Performance
SQL Cursor, SQL Scripts, SQL Server, SQL Stored Procedure

NOCOUNT performance depends on the messages that SQL Server no longer sends to the client. This post counts the network packets of a procedure with a 5,000 step loop, with the setting off and on. It also explains why some tests show no time gain, and where the setting helps most.

Read More
Gouache painting of six clay pots on a potting bench, five tipped over and empty, one upright vermilion pot

Drop Tables by Prefix in SQL Server and Azure SQL Database

June 21, 2019
Pinal Dave
SQL Tips and Tricks
SQL Azure, SQL Cursor, SQL Scripts, SQL Table Operation

To drop tables by prefix, list the matching tables first and drop them with a script that quotes every schema and table name. This post shows why the underscore in a prefix is a trap, a one-statement version and a cursor version. It works in SQL Server and in Azure SQL Database.

Read More
1 2 3 4 … 6 Next
  • Books
  • Testimonials
  • Privacy Policy

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