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 leaf under an old brass magnifying glass and a new lens with a vermilion rim

DMV Version of sp_who2: A Cleaner Session List

December 16, 2020
Pinal Dave
SQL Tips and Tricks
SQL DMV, SQL Monitoring, SQL Performance, SQL Scripts, SQL Server

A DMV version of sp_who2 returns the same session details from documented views and leaves out the system tasks. This post builds the query, shows why the old spid above 50 filter fails, and stores the result in a temporary table.

Read More
A hand pausing on a dusty draw-stop of an old church organ, the other stops polished from use

Finding Old Agent Jobs Not Run in Months or Never Scheduled

December 14, 2020
Pinal Dave
SQL Tips and Tricks
DBA, SQL Scripts, SQL Server Agent, SQL System Table

Review agent jobs not run recently or lacking schedules, combine history and activity, and disable approved candidates for review.

Read More
Gouache painting of a white gift box tied with a vermilion ribbon bow on a pale counter

Unquoted Procedure Parameters: Are Single Quotes Optional?

December 10, 2020
Pinal Dave
SQL Tips and Tricks
SQL Error Messages, SQL Scripts, SQL Server, SQL Stored Procedure

Unquoted procedure parameters work in SQL Server when the value is one plain word. This post builds a small procedure and tests which values fail without single quotes. It also shows how NULL, DEFAULT and numbers change the value.

Read More
Gouache painting of a strand of wooden beads above three small rings of beads, the middle ring holding one vermilion bead

Convert Integer to Date in SQL Server: ddMMyyyy Values

December 9, 2020
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts

To convert integer to date values such as 09122020, split the number into day, month and year and build the date from the parts. This post compares four methods on tested data, shows why a lost leading zero and the session language break two of them, and times them on a million rows.

Read More
Gouache painting of a tortoise leaving a long winding trail in the sand with a small vermilion dot nearby

Slowest Cached Queries in SQL Server: Time, Reads and Plan

December 7, 2020
Pinal Dave
SQL Performance
Execution Plan, SQL DMV, SQL Scripts

To find the slowest cached queries in SQL Server, rank each statement by its average elapsed time and keep its plan beside it. This post builds a small workload, reads sys.dm_exec_query_stats with the plan, and shows why a database filter on the sql text hides every ad hoc query.

Read More
Gouache painting of a hose watering a vermilion pot beside three potted plants against a pale wall

sp_updatestats and Disabled Indexes: What Gets Updated

December 4, 2020
Pinal Dave
SQL Performance
SQL Index, SQL Scripts, SQL Statistics

sp_updatestats and disabled indexes: the procedure updates statistics on disabled nonclustered indexes and skips a table whose clustered index is disabled. This post proves both, times the cost of disabled indexes against dropped ones on a million rows, and generates a targeted update that skips them.

Read More
A knife block with five large knives, beside one small pot holding all the smaller utensils bunched together.

Top N Plus Others: Grouping the Rest Into One Row

December 3, 2020
Pinal Dave
SQL Tips and Tricks
Ranking Functions, SQL Group By, SQL Scripts, SQL Server, SQL Top

Create top N plus others summaries with deterministic category ranking, one remainder total, stable labels, and explicit display ordering.

Read More
Previous 1 … 23 24 25 26 27 28 29 … 365 Next
  • Books
  • Testimonials
  • Privacy Policy

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