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
Ash and a remaining ember indicate a recent fire without revealing its complete history

When was Stored Procedure Last Compiled? – Interview Question of the Week #292

September 6, 2020
Pinal Dave
SQL Interview Questions and Answers
SQL Cache, SQL Performance, SQL Scripts, SQL Server, SQL Stored Procedure

Question: When was Stored Procedure Last Compiled?

Answer: Honestly, it is difficult to figure out when was the stored procedure last compiled.

Read More
recent execution

Recent Execution of Stored Procedure – SQL in Sixty Seconds #118

September 5, 2020
Pinal Dave
SQL Video
SQL DMV, SQL in Sixty Seconds, SQL Server Management Studio, SQL Stored Procedure

My clients were not sure which SPs are the recent SP and which SP is no longer used. Today we will learn about the recent execution of the stored procedure. 

Read More
Gouache painting of a wooden hopper pouring wheat in and flour out into a bowl, with the hopper painted vermilion

Dynamic SQL Output Parameter: Pass Values In and Out Safely

July 23, 2020
Pinal Dave
SQL Tips and Tricks
Dynamic SQL, SQL Scripts, SQL Stored Procedure

A dynamic SQL output parameter lets a statement built at run time hand a value back to the caller. This post shows input, output and input/output parameters with sp_executesql, explains the errors you meet, and measures why parameters beat concatenation: one reusable plan instead of ten, and no injection.

Read More
Gouache painting of two goats meeting on a narrow bridge with a small vermilion passing platform added to its side

Deadlock Victim Selection: Protect One Transaction

June 24, 2020
Pinal Dave
SQL Performance
Deadlock, SQL Lock, SQL Server Configuration, SQL Stored Procedure

Deadlock victim selection decides which of two blocked transactions SQL Server rolls back. This post shows the rules, sets DEADLOCK_PRIORITY on one procedure, reproduces a deadlock with two query windows, and shows what the setting cannot do. It ends with the two fixes that remove the deadlock itself.

Read More
Gouache painting of a market stall with two rows of sorted apples and a vermilion arrow post pointing at one row

ORDER BY a Parameter in SQL Server: CASE, Types and Plans

June 8, 2020
Pinal Dave
SQL Tips and Tricks
SQL CASE, SQL Order By, SQL Scripts, SQL Stored Procedure

To ORDER BY a parameter in SQL Server, write one CASE expression for each column and direction. This post builds the procedure, shows the type conversion and DISTINCT errors that trip people up, measures the cost of the sort that CASE forces, and compares OPTION (RECOMPILE) and dynamic SQL.

Read More
Gouache painting of an open old trunk with brass binoculars resting on a vermilion cloth

sp_helpdb in SQL Server: List Databases and Their Files

April 21, 2020
Pinal Dave
SQL Tips and Tricks
SQL Command, SQL Data Storage, SQL Scripts, SQL Stored Procedure

sp_helpdb in SQL Server lists every database on an instance, or the files of one database, with a single call. This post builds three small databases, reads the output column by column and explains why db_size is text. It also shows how to filter the result and how to find free space.

Read More
Gouache painting of a beagle sitting beside a wicker picnic basket with a vermilion cloth, looking away

DISABLE_PARAMETER_SNIFFING Hint: Turn Off Sniffing for One Query

February 12, 2020
Pinal Dave
SQL Performance
Execution Plan, Parameter Sniffing, Query Hint, SQL Scripts, SQL Stored Procedure

The DISABLE_PARAMETER_SNIFFING hint makes one query ignore the parameter value it was first compiled for. This post compares it with the default, OPTIMIZE FOR UNKNOWN and RECOMPILE on a table where one customer owns 40 percent of the rows. The reads show which variant fits which workload.

Read More
Previous 1 2 3 4 5 6 7 8 … 36 Next
  • Books
  • Testimonials
  • Privacy Policy

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