Posted by: sanjnep71 December 18, 2006
Any TSQl experts???????
Login in to Rate this Post:     0       ?        
Hi bhan0001, I think if u take little different approach it will be easier. If you need to find uniqueness on emp table just join emp table with inserted table. 1.select @empno = empno from emp as e inner join inserted as i on e.empno = i.empno if you don't get value @empno you should consider the inserted empno is unique. set @flag1 = true for second step just find from inserted table the deptno 2.select @deptno = deptno from inserted as i inner join dept as d on i.deptno = d.deptno if you get value for @deptno you should consider the deptno is exists set @flag2 = true if both flag1 and flag2 true then you can write insert statement. Hope you understand. Thanks a lot
Read Full Discussion Thread for this article