why do you need @t twice? wont this suffice?INSERT INTO HFC.dbo.ERRORS (TABLENAME, ROW_ID, MPI, ERRORMSG)SELECT @tablename AS TableName,ROW_ID,MPI,'No Matching record' AS ErrorMSGFROM @t spWHERE NOT EXISTS(SELECT 1FROM eli.dbo.Elig eJOIN eli.dbo.Accounts ea ON ea.AccountID = e.ACCOUNTIDJOIN LFL.dbo.Accounts la ON la.AcctID = ea.AcctidJOIN LFL.dbo.pa p ON p.AccountID = la.ACCOUNTID AND p.SSNum = e.HCNIDWHERE e.EID = sp.E_ID);
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/