How to Change a Column Type in SQL Server
Last updated July 25, 2026 · By the SaturnSQL team
Use ALTER TABLE ... ALTER COLUMN with the full new definition, including NULL or NOT NULL. If you leave nullability out, SQL Server resets the column to nullable under default settings, a common surprise.
ALTER TABLE orders ALTER COLUMN amount DECIMAL(14,2) NOT NULL;Check for values that will not convert
TRY_CONVERT returns NULL instead of erroring, so you can count offending rows before the ALTER.
SELECT COUNT(*) AS bad_rows
FROM events
WHERE TRY_CONVERT(INT, external_ref) IS NULL
AND external_ref IS NOT NULL;ALTER COLUMN fails while indexes, defaults, or check constraints reference the column; drop those first and recreate them after.
Run this in SaturnSQL
SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.
Try it free