Tuesday, June 12, 2012

SQL Script to Update the Record Exits Column


SET NOCOUNT ON;
UPDATE [dbo].[Table_Name1] 
SET  [RecordExists]=1
FROM [dbo].[ Table_Name1 ] AS T1
WHERE EXISTS (SELECT T2.RecordId FROM [dbo].[Table_Name2] T2
WHERE  T2.RecordId = T1.RecordId )
AND T1.Operation = 'M'  AND T1.[RecordExists] is NULL


SELECT ?=@@ROWCOUNT


*Need to update the variable for 'RowCount' in Parameter Mapping option. 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.