Hi
Can anyone tell me how to prevent duplicate insetting values for selected column (exp : id, name) in sql server 2005 manually
I am not required Unique contains.(I have to check multiple table Coolum )
I please give me Trigger from Preventing duplicate column value inset in table
I tried this below code. using this I am unable to insert rows in slq server table.
create TRIGGER trg_test1 ON view_test
INSTEAD OF INSERT
AS
BEGIN
IF EXISTS ( select id,name from dbo.test group by id,name HAVING COUNT(*) > 1)
begin
Print 'Cannot insert duplicate values!------ test'
--RAISERROR('Cannot insert duplicate values!------ NSU test',1,1)
ROLLBACK TRANSACTION
end
else
begin
Print 'INSERT-------------! test'
end
end