INSERT INTO [Table1] ( Class, DateAdded, User, [Type], NewReference ) ( SELECT Class_ID, GetDate(), @User_ID, table2_id, @Current_Lot FROM Table2 CROSS JOIN @StripList WHERE MType = 'Add New' )
INSERT INTO [Table1] ( Class, DateAdded, User, [Type], OldReference, NewReference ) ( SELECT Class_ID, GetDate(), @User_ID, table2_id, T1.OldReference, @Current_Lot FROM Table1 T1, Table2 CROSS JOIN @StripList WHERE MType = 'Add New' )
UPDATE T1 SET DateAdded=GETDATE() --I believe you need a field for UpdateDate , User=@USER_ID ,Type=table2_id ,OldReference =t1.newReference ,NewReference=@Current_Lot FROM Table1 T1, Table2 CROSS JOIN @StripList WHERE MType = 'Add New'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)