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
Gouache painting of a courtyard of leaf-covered squares with one swept clean and a vermilion-handled broom

Clear Procedure Cache for One Database in SQL Server

January 27, 2018
Pinal Dave
SQL Tips and Tricks
SQL Cache, SQL Scripts, SQL Server, SQL Stored Procedure

To clear procedure cache for one database, run ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE inside that database. This post tests it on two demo databases, shows that the other database keeps its plans, and shows how to remove a single plan by its plan handle. It also covers the cost and the lighter alternatives.

Read More
A brass umbrella stand of identical cream umbrellas, one marked only by a small red tassel.

The sp_ Prefix: Finding Stored Procedures Named the Risky Way

January 11, 2018
Pinal Dave
SQL Tips and Tricks
Best Practices, SQL Coding Standards, SQL Server, SQL Stored Procedure

Find user procedures with the sp_ prefix across databases, understand the lookup risk, and move callers through a synonym safely.

Read More
SQL SERVER – xp_cmdshell and Net Use ERROR: The Local Device Name is Already in Use

SQL SERVER – xp_cmdshell and Net Use ERROR: The Local Device Name is Already in Use

December 29, 2017
Pinal Dave
SQL Tips and Tricks
Command Line, SQL Command, SQL Error Messages, SQL Scripts, SQL Server, SQL Stored Procedure

Mapping a share with net use through xp_cmdshell, I hit “The local device name is already in use”. Here is what causes this error and how to solve it.

Read More
One marked boat is identifiable among several moored boats

How to Identify Session Used by SQL Server Management Studio? – Interview Question of the Week #151

December 10, 2017
Pinal Dave
SQL Interview Questions and Answers
SQL Server, SQL Server Management Studio, SQL Stored Procedure

An interview candidate asked us: how do you identify session IDs that SQL Server Management Studio is using? Here is a simple answer with sp_who2.

Read More
SQL query execution results.

SQL SERVER- New DMF in SQL Server 2017 – sys.dm_os_file_exists. A Replacement of xp_fileexist

November 4, 2017
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL Server 2017, SQL Stored Procedure

SQL Server 2017 adds a new DMF, sys.dm_os_file_exists, a replacement of xp_fileexist that suits both Windows and Linux. Here is how to use it.

Read More
Gouache painting of a path of stepping stones with one worn stone and a vermilion hourglass beside it

Stored Procedure Execution Count and Average Elapsed Time

October 19, 2017
Pinal Dave
SQL Tips and Tricks
SQL DMV, SQL Scripts, SQL Server, SQL Stored Procedure

To find a stored procedure execution count, query sys.dm_exec_procedure_stats and divide the total elapsed time by the count. This post builds a demo, shows the query, and explains why the numbers start again when a plan leaves the cache. It also fixes the object name lookup that returns NULL for other databases.

Read More
Gouache painting of a line of watering cans by a greenhouse door, the first one vermilion

Run a Stored Procedure at Startup in SQL Server

October 16, 2017
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL Stored Procedure, Starting SQL

To run a stored procedure at startup, create it in the master database and mark it with sp_procoption. This post builds a demo that writes one row every time the instance starts. It also covers the rules, how to check the setting, and how to turn it off again.

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

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