Situation is as below. I have a table like here:
Col1 Col2 Col3 Col4 Col5 Col6
a b c 1 e 1
a b c 3 l 1
a b c 1 e 0
a b f 1 f 1
The idea is that I cant update existing data or add new row
which has combination a b c 1 ? 1.
I have to block adding 1 in last column if there
is already some combination of cols 1-3, but I can still may
add same combination with 0 in col 6.
For more complex logic, you use triggers: trigger gets triggered at specified time (insert, update, delete) – before (use word “for”) or after.
Your example – trigger that does not allow inserting given combination of columns:
Of course, you can create trigger for update (use “inserted” table), or for delete (use “deleted” table).
You might do other actions (like inserting another row in another table), …
Give a MSDN try as well: http://msdn.microsoft.com/en-us/library/ms189799(v=SQL.90).aspx