Reputation: 137
I have a table in SQL Server which has a constraint like Not null
. When I enter new entry if I am not filling anything, SQL Server pops error message preventing Null
value.
But once I enter one record and later if I edit that record by just deleting the data in this column, SQL Server is accepting the empty string.
Upvotes: 2
Views: 2413
Reputation: 407
By UI you can add constraint by following step
Upvotes: 1
Reputation: 35477
You can use a CHECK CONSTRAINT
ALTER TABLE table
ADD CONSTRAINT chkNotEmpty CHECK (LEN(col) > 0 );
Upvotes: 5