I am working on C# app using SQL Server as database here is a very simple problem which I could not find out till now. I created a check constraint on my QUANTITY
column like this:
QUANTITY >= 0
The quantity is updating from C# and I don't want the quantity to become less than zero but when my quantity is 2 and I subtract 2 so it should allow zero as a quantity but not less than 0 but it throws following exception :
The UPDATE statement conflicted with the CHECK constraint \"CK_ITEM_DETAILS_QUANTITY\". The conflict occurred in database \"MyDatabase\", table \"dbo.ITEM_DETAILS\", column 'QUANTITY'.\r\n The statement has been terminated.
Any idea what I'm doing wrong?