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 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
A toast rack on a breakfast table, some slots holding toast and some empty, beside a small jar of marmalade.

How Much Space Does a NULL Take? NULL Storage in Rows

December 23, 2019
Pinal Dave
SQL Tips and Tricks
Compression, SPARSE Columns, SQL Data Storage, SQL NULL, SQL Server

Measure NULL storage in ordinary rows, compare fixed and variable columns, inspect record size, and test sparse and compressed designs.

Read More
A hand watering the one dry pot in a row of geraniums on a porch step, the other pots left alone

Skipping No-Op Updates: Changing Only Rows That Really Differ

December 16, 2019
Pinal Dave
SQL Tips and Tricks
SQL NULL, SQL Scripts, SQL Server, SQL Server 2022, SQL Trigger

Skip no-op updates with NULL-safe EXCEPT or IS DISTINCT FROM, inspect affected counts, and avoid unnecessary rowversion and trigger changes.

Read More
Gouache painting of a tray of cream, sage and slate thread spools with one spool wearing a vermilion ring

Nullable Columns in a Database: List Them and Count NULLs

December 12, 2019
Pinal Dave
SQL Tips and Tricks
SQL Column, SQL NULL, SQL Scripts

Nullable columns in a database cost you ISNULL calls and OR IS NULL conditions in every query. This post lists them with a catalog query, compares the INFORMATION_SCHEMA version, and counts the real NULLs in each column. The count tells you which columns can become NOT NULL and which can go.

Read More
A large open steamer trunk in an attic holding only a few linens, some matching socks and one long red umbrella.

Profiling a Table’s Data: Nulls, Distinct Values and Lengths

July 2, 2019
Pinal Dave
SQL Tips and Tricks
DBA, SQL Column, SQL Datatype, SQL NULL, SQL Server

Start profiling a table’s data with null counts, distinct values, lengths, and generated checks that expose misleading column definitions.

Read More
Gouache painting of a wooden shelf holding five small ceramic jars, four with blank cream paper tags and one with only a bare vermilion string

ArgumentNullException: Value Cannot Be Null in SQL Server Setup

May 9, 2019
Pinal Dave
SQL Tips and Tricks
SQL Error Messages, SQL NULL, SQL Server, SQL Server Installation

Value cannot be null was the message when a client’s automated SQL Server installs failed at random. Detail.txt named the parameter instanceName. The generated configuration file had no InstanceName for a default instance, and that is what setup choked on.

Read More
Gouache painting of a wooden pigeonhole cabinet filled with blocks except one slot, with a vermilion block waiting beside it

Change Column From NULL to NOT NULL in SQL Server

January 12, 2018
Pinal Dave
SQL Tips and Tricks
SQL Column, SQL Datatype, SQL NULL, SQL Scripts

To change a column from NULL to NOT NULL, first fill every NULL value, then run ALTER COLUMN with the full data type and NOT NULL. This post shows the Msg 515 error you get otherwise, how to choose the replacement value, and the trap that makes a column nullable again. It ends with a default constraint that keeps new rows valid.

Read More
Previous 1 2 3 4 5 6 … 13 Next
  • Books
  • Testimonials
  • Privacy Policy

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