
Originally Posted by
krishnaindia2007
Information provided by you is not enough to write entire procedure.
Based upon the output provided by you I assume that only some of the employees are having both old and new salaries.
In that case first identify the list of those employees who salary is revised.
Cursor v_cur is
SELECT ejheeid
FROM dbo.emphjob
WHERE IsRateChange = 'Y'
Open another and pass this ejheeid as parameter to new cursor.
Capture old and new salaries based on isratechange flag.
IsRateChange flag 'N' - old salary
IsRateChange flag 'Y' - new salary
Regards
Krishna