Hi,
I need to update a column based on current row value and previous row value. IF both are not equal then i should make a update. ex: Name_Previous_Value : "Application" . Name_Current_Value : "Request" . In this case I am using the below code and updating,
IF @Name_Previous_Value <>@Name_Current_Value
BEGIN
SET @myqry2='UPDATE SSDB_Railroad SET Name = '+ ''''+@Name+'''' +' '+'WHERE Name = ' + ''''+@Name1+''''
EXECUTE sp_executesql @myqry2
END
In other scenario i have previous row value as NULL , Can i compare in a same way and update the current row based on previous row? Below is the screenshot
Here RC2KEY column is NULL in previous row as well as current row . How do i update the current row? Pls help
Deepa