CREATE PROCEDURE salemp
( @employeeId int, @ID int, @processedon DateTime, @salary int )
IF EXISTS(SELECT 'True' FROM payroll WHERE employeeId=@employeeId)
BEGIN --This means it exists, return it to ASP and tell us SELECT 'This record already exists!'
BEGIN --This means the record isn't in there already, let's go ahead and add it SELECT 'Record Added'
update payroll set salary = (employee.Basicsalary +employee.HRA + employee.Allowance - employee.Deductions) from employee where employee.employeeId = payroll.employeeId;