SQL Server Science

Technical Articles for the DBA / Developer

Home

COUNT Under the Hood

2026-09-10 · by Hannah Vernon · in t-sql

COUNT() and COUNT_BIG() do the same thing: they return the total number of rows in your result set, or the number of rows-per-group with GROUP BY. Only COUNT_BIG() works when there are more than 2,147,483,647…

COALESCE in a WHERE Clause Costs You the Row Estimate

2026-09-09 · by Hannah Vernon · in t-sql

Optional filter parameters are everywhere in reporting procedures. Pass a value and you want that value; pass NULL and you want everything. There are two common ways to write it, and I have carried a…

Double-Hyphen Comments Can Comment Out Your WHERE Clause

2026-09-08 · by Hannah Vernon · in t-sql

-- and /* */ both comment out T-SQL. The difference is where they stop. /* */ stops where you close it. -- runs to the end of the line,[2] and if there is no end…

One NULL in the List and NOT IN Returns Nothing

2026-09-07 · by Hannah Vernon · in t-sql

NOT IN and NOT EXISTS read like the same thing. Find the rows that are not in that other set. They agree until the other set contains a NULL, at which point NOT IN returns…

ISNULL Truncates Your Replacement Value; COALESCE Doesn’t

2026-09-06 · by Hannah Vernon · in t-sql

ISNULL and COALESCE look like the same function wearing different names. Both take a value, both give you something else when that value is NULL. They differ in how they decide the type of what…

Proving the Restore, Part 14: Getting the Script Out of the Procedure

2026-09-05 · by Hannah Vernon · in recovery

The generator from builds a restore script into a variable. Getting it back out so someone can read it before running it seems like the easy part. PRINT @script returns the beginning of it. How…

1 2 … 53 Next »

Search

Categories

  • AI for DBAs
  • announcements
    • events
  • basics
    • localization
  • configuration
  • Data Architecture
  • DMVs
  • documentation
  • extended-events
  • Git for DBAs
  • High Availability
  • Hot Takes
  • Internals
  • maintenance
    • patching
  • Opinion
  • performance
  • PostgreSQL
  • Professional Development
  • recovery
  • reporting
  • ROLLBACK;
  • security
    • data security
  • service broker
  • SQL Server Agent
  • statistics
  • sys
  • t-sql
    • xml
  • tools
    • data masking
    • wsus
  • troubleshooting
  • Uncategorized

Pages

  • About SQL Server Science
  • Get Better Help with a Minimal, Complete, and Verifiable Example, or MCVE
  • Privacy Policy

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.

To find out more, including how to control cookies, see here: Cookie Policy

Copyright © 2026 SQL Server Science