Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Continuation in the Insert of my previous problem

Author  Topic 

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2011-09-14 : 16:43:04
------Insert the Records inside T2 to keep track of records deleted---------

IF EXISTS (SELECT * FRom PMO_IA_Tasks Where ia_task_assignee is not Null)
Begin
INSERT INTO [PMO_IA_Forum](Project,Comments, created, created_by )
SELECT Project, ia_task_assignee + '' + 'Employee is not longer in the company', GETDATE(), 'Auto Generate by System'
FROM #TP_AuditTask_vs_ldap

update a
set a.ia_task_assignee = ''
FROM ITPM.dbo.PMO_IA_Tasks a
INNER JOIN
#TP_AuditTask_vs_ldap b on a.Project = b.Project And a.ia_task_assignee = b.ia_task_assignee
End

*The Insert statement is not working it continue to insert every time the stored procedure is executed.

Thanks,

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-09-14 : 16:55:44
Explain "not working", please.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -