question

jyoti avatar image
jyoti asked

how to find salary of an employee according to no. of working days based on date of joining

CREATE PROCEDURE salemp

( @employeeId int, @ID int, @processedon DateTime, @salary int )

As

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!'

END

ELSE

BEGIN --This means the record isn't in there already, let's go ahead and add it SELECT 'Record Added'

INSERTintopayroll(ID,processedon,employeeId,salary) VALUES(@ID,@processedon,@employeeId,@salary)

END

update payroll set salary = (employee.Basicsalary +employee.HRA + employee.Allowance - employee.Deductions) from employee where employee.employeeId = payroll.employeeId;

mysqlstored proceduressqlserver-2012
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.