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 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
Drive path query window.

SQL SERVER – New DMV in SQL Server 2017 – sys.dm_os_enumerate_fixed_drives. A Replacement of xp_fixeddrives

September 22, 2017
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL Server 2017, SQL Stored Procedure

SQL Server 2017 adds sys.dm_os_enumerate_fixed_drives, a new DMV that shows free space on each drive and replaces xp_fixeddrives. Here is the query I use.

Read More
Unknown shapes emerge from a chute and are placed into an adjustable sorting frame

How to Create Temp Table From Stored Procedure? – Interview Question of the Week #140

September 17, 2017
Pinal Dave
SQL Interview Questions and Answers
SQL Scripts, SQL Server, SQL Stored Procedure, Temp Table

How do you create a Temp Table from a stored procedure when you do not know its result set? Here is the OPENROWSET approach I use, and its drawbacks.

Read More
Execution Plan of SQL Query.

SQL SERVER – How to Find UNIQUE Key Columns? – sp_special_columns

September 8, 2017
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL Scripts, SQL Server, SQL Stored Procedure

Want to know which columns uniquely identify a row in a table? The system stored procedure sp_special_columns tells you. Here is a quick demo.

Read More
A key and inspection mirror sit near a doorway into a separate stocked storage room.

SQL SERVER – System Procedure to List Out Table From Linked Server

September 7, 2017
Pinal Dave
SQL Tips and Tricks
Linked Server, SQL Scripts, SQL Server, SQL Stored Procedure

The System Procedure sp_tables_ex lists table metadata from an existing linked server. I check its provider and login mapping separately.

Read More
Two separate trays of objects presented together in one tray

How to Show Results of sp_spaceused in a Single Result? – Interview Question of the Week #135

August 13, 2017
Pinal Dave
SQL Interview Questions and Answers
SQL Scripts, SQL Server, SQL Stored Procedure

How do you show results of sp_spaceused in a single result? My co-interviewer asked this. I think it is a poor interview question, but here is the answer.

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

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