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 long loaf cut into slices in a row, one slice topped with vermilion jam

Partition Function Fanout: Count Partitions in SQL Server

June 3, 2020
Pinal Dave
SQL Performance
SQL DMV, SQL Function, SQL Scripts, Table Partitioning

Count partitions in SQL Server by reading the fanout of a partition function. This post reads fanout and modify_date from sys.partition_functions, watches SPLIT RANGE and MERGE RANGE change them, and finds functions that no table uses.

Read More
A hand with sugar tongs dropping a sugar cube into each of a long row of teacups, the sugar bowl nearly empty.

Scalar Function Statistics With sys.dm_exec_function_stats

May 30, 2020
Pinal Dave
SQL Performance
SQL DMV, SQL Function, SQL Performance, SQL Server

Read dm_exec_function_stats to rank scalar UDF activity, inspect callers, verify collection settings, and recognize inlined work.

Read More
A nonempty uniform bead strand fits a tray while empty and mismatched candidates remain separate.

SQL SERVER – Validating Positive Integer Strings with Explicit Boundaries

May 25, 2020
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server, SQL String

To Validate Natural integer strings, I define a nonempty positive ASCII-digit contract. A customer wanted a simpler validator.

Read More
Gouache painting of a row of five wooden doors in a stone wall, four grey and slate and one vermilion

HAS_DBACCESS Function: List the Databases You Can Open

May 16, 2020
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Scripts, SQL Server Security

The HAS_DBACCESS function tells you whether the current login can open a database. One query over sys.databases turns it into a list, and this post tests six databases to show what each zero means: no user, offline, restricted or a busy single user slot.

Read More
Hands sorting a tipped-out lost property box into heaps of umbrellas, gloves and scarves on a table

Schema Discovery for JSON Columns: Listing Every Key With OPENJSON

April 4, 2020
Pinal Dave
SQL Tips and Tricks
JSON, SQL Function, SQL Scripts, SQL Server

Use schema discovery on JSON columns to count keys and types, inspect nested objects, and find missing required paths with guarded input.

Read More
A bowl of cake batter, a big scoop of flour and a small spoon of cocoa going in, the mix turning only faintly brown.

Weighted Averages in T-SQL

March 28, 2020
Pinal Dave
SQL Tips and Tricks
Mathematical Function, SQL Function, SQL Scripts, SQL Server

Calculate weighted averages with matching numerator and denominator populations, decimal arithmetic, NULL rules, and calendar windows.

Read More
Gouache painting of a seedling tray with most cells sprouted and three empty, with a vermilion watering can beside it

Count NULLs in a Column in SQL Server: Five Ways Compared

March 5, 2020
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Group By, SQL NULL, SQL Scripts

To count NULLs in a column, filter with IS NULL and count the rows, or subtract COUNT(column) from COUNT(*). This post tests five ways on 100,000 rows and compares their page reads. It also counts NULLs in several columns at once and shows the NULL group in GROUP BY.

Read More
Previous 1 … 5 6 7 8 9 10 11 … 92 Next
  • Books
  • Testimonials
  • Privacy Policy

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