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.
AVG of an Integer Column Returns an Integer: Getting Decimals Back
The dashboard says the average is 1 when everyone can see it is 1.5. Here is why AVG does that and the one-line fix.
Drop Multiple Columns in One ALTER TABLE Statement
To drop multiple columns, list them after one DROP COLUMN in one ALTER TABLE statement. This post tests the syntax on a table with a default, a check constraint and an index, shows the error that a dependent object causes and drops the constraints and columns together. It also explains why the disk space doesn’t return until a rebuild.
Tables Containing a Column: Search by Name in SQL Server
To find tables containing a column, search sys.columns by name instead of opening tables one by one. This post searches one database, then every database on the server, and shows why an underscore in the pattern needs brackets. It also compares the data types of related columns.
SQL SERVER – Swap Column Values In Table
Here is a question asked to me during Comprehensive Database Performance Health Check. The question was about how to swap column values in a table.
Profiling a Table’s Data: Nulls, Distinct Values and Lengths
Start profiling a table’s data with null counts, distinct values, lengths, and generated checks that expose misleading column definitions.
SQL SERVER – Measuring the Length of VARCHAR and NVARCHAR Columns with COL_LENGTH
Does an NVARCHAR column take twice the space of VARCHAR? Yes. I measure the length of VARCHAR and NVARCHAR columns with COL_LENGTH to show it.







