April 25, 2008 at 3:24 am
Hello,
i sathish getting problem in the triggers for this coding
insered trigger query.
create trigger trig1
on emp
for insert
as
begin
if((select count(emp_id)
from emp,inserted
where inserted.emp_id = emp.emp_id)>1)
begin
print'duplicate are not allowed'
rollback
end
else
commit
end
error message is this
Msg 209, Level 16, State 1, Procedure trig1, Line 6
Ambiguous column name 'emp_id'.
regards,
sathish.
April 25, 2008 at 3:27 am
April 25, 2008 at 3:56 am
Why don't you just put a unique constraint on the emp_id column? No need for a trigger at all.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 25, 2008 at 4:00 am
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply