To count a particular value across all columns of a table, use a CASE sum, CROSS APPLY with VALUES, UNPIVOT or UNION ALL. This post tests all four on a staff contact table, compares their reads on 200,000 rows, and builds the column list with dynamic SQL.
Tagging Personal Data Columns With ADD SENSITIVITY CLASSIFICATION
Add sensitivity classification to reviewed columns, inspect stored labels, and keep discovery separate from encryption and access controls.
JSON_MODIFY: Changing One Property Inside a JSON Column
Edit one value inside a JSON document without string surgery. A hands-on tour of the quirks with types, NULL, missing paths and retries.
Blind Index: Searching an Encrypted Column Without Decrypting
Encrypted emails cannot be searched, so store a keyed digest beside them. A hands-on demo of how it works, what it leaks and how rotation hurts.
Change Column From NULL to NOT NULL in SQL Server
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.
SQL SERVER – Puzzle – Brain Teaser – Changing Data Type is Changing the Default Value
Changing the Default Value is the question behind this data-type puzzle. I keep the expression, data type and nullability separate.
COL_NAME Function in SQL Server: Get a Column Name by ID
The COL_NAME function returns a column’s name when you give it a table’s object ID and the column’s ID. This post uses it to turn the column IDs in index views into names, shows why a column ID is not a position once a column has been dropped, and explains the trap that returns a wrong name when the table lives in another database.







