HI There
I want to pick someones brain
I am using a Trigger to search for existing values in a column in a table to look if the value is already in the table before inserting:
here is my statement to look for duplications:
-- If a duplicate has been found, rollback transaction and report error.
if EXISTS(select 1
FROM inserted
INNER JOIN Table1 M ON
inserted.ID = M.ID
WHERE inserted.Client_Id >= inserted.Client_Id)
Please can anyone tell me if this is correct as i been struggling for three days now and just cant get it to look for the duplications in the table that already exist
I want to pick someones brain
I am using a Trigger to search for existing values in a column in a table to look if the value is already in the table before inserting:
here is my statement to look for duplications:
-- If a duplicate has been found, rollback transaction and report error.
if EXISTS(select 1
FROM inserted
INNER JOIN Table1 M ON
inserted.ID = M.ID
WHERE inserted.Client_Id >= inserted.Client_Id)
Please can anyone tell me if this is correct as i been struggling for three days now and just cant get it to look for the duplications in the table that already exist