Mistake #7: treating every string as variable-length. NCHAR is a fixed-length Unicode type; SQL Server pads shorter values with whitespace, so NCHAR(2) suits codes that always occupy two characters but can waste space for shorter or irregular data. section 3.2
Fixed length affects storage rather than merely documenting expected size. SQL Server stores rows on 8 KB pages and records fixed-length metadata, so choosing NCHAR requires considering padding, row capacity, and downstream maintenance. section 3.2
Department codes
Convert a consistently two-character department code with: ALTER TABLE dbo.Employees ALTER COLUMN DepartmentCode NCHAR(2);
Use NCHAR when the value is genuinely fixed-width; otherwise check the consequences before choosing it.
- Choose NCHAR for codes with a stable width, not simply because a maximum length is known. section 3.2
- Expect whitespace padding and account for its storage impact. section 3.2
