If you’re getting SQL Server error 8111 that reads something like “Cannot define PRIMARY KEY constraint on nullable column in table ‘Employees’“, it’s probably because you’re trying to add a PRIMARY KEY constraint to an existing column that is nullable. In other words, the column isn’t defined with a NOT NULL constraint.
We can only add primary keys to columns that are defined as NOT NULL.
To fix this issue, define the table as NOT NULL before attempting to add the primary key.