
March 19th, 2004, 03:36 AM
|
 |
Contributing User
|
|
Join Date: Feb 2004
Location: Belgium, Antwerp
Posts: 177
Time spent in forums: 24 sec
Reputation Power: 5
|
|
Constraints by triggers
after the bit field Locked is 1, no changes may occur to the record, the following trigger is the closest i can get to it, but now i can't put the Locked field to 1 either
can anyone correct my trigger or give me an alternitive way of implementing this on a database level ?
PHP Code:
CREATE TRIGGER dbo.Locked_Constraint_Versie ON dbo.Offerte_Versie AFTER UPDATE AS IF (0 < (SELECT COUNT(*) FROM inserted WHERE inserted.Versie_ID IN (SELECT Offerte_Versie.Versie_ID FROM Offerte_Versie WHERE Offerte_Versie.Locked = 1)) ) BEGIN RAISERROR('Version is locked, no actions permitted',16,1) ROLLBACK TRANSACTION END
|