1. Mistake: storing every flag as INT. SQL Server BIT stores only 0, 1, or NULL, making it suitable for Boolean values such as whether an employee is staff or a contractor. It also reduces wasted storage, especially in large tables or indexed columns. section 3.1
Remember these conversion rules:
- TRUE and FALSE become 1 and 0 automatically. section 3.1
- Any numeric value other than 0 or 1 becomes 1, so unexpected inputs can silently mean true. section 3.1
- The first eight BIT columns use one byte; each subsequent group of eight adds another byte. section 3.1
Employees table
Define a flag with BIT when its values represent a binary choice: `StaffOrContract BIT NOT NULL`. For example, `SELECT CAST(86.2 AS BIT)` returns 1, demonstrating why input validation still matters. section 3.1
