Before Insert validation in SQL Server 2000
Posted on 2004-04-06
I have to do a data validation on DB level to prevent the duplicate primary key issue.
I am thinking to implement this by a trigger.
My code is as following:
CREATE TRIGGER VALIDATION ON [dbo].[AAA]
DECLARE @A INT,@B INT, @C INT
IF NOT EXISTS (select * from AAA Where @A=A AND @B=B AND @C=C)
INSERT INTO AAAA
However,this validation needs to be done "Before Insert" which is a feature of Oracle. It seems that there no counterpart function available in SQL Server 2000 ( the one I am working with).
Could some one kindly provide a solution for this?
Thank you in advance.