Click here to Skip to main content
15,441,434 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
please reply me fast ......i have a requirement as below..
increment the employee salary 15% if he has 2 years of experience?
table name=employee_info
columns are
emp_id;emp_name;salary;dateofjoin.

using SQL or SQL SERVER

please reply me some one fast...i am waiting eagerly.
Posted
Updated 3 days ago
Comments
thatraja 19-Dec-13 5:15am     CRLF
Don't repost questions hereafter. Update old questions with some more details. Or raise a comment vs answers. So don't repost again unless you want your account get banned.

It should be something like this..

SQL
SELECT salary + (salary * 15/100) as NewSalary, emp_name
FrOM employee_info
Where DATEDIFF(MONTH, dateofjoin, GETDATE())/12 =2
 
Share this answer
 
Comments
joginder-banger 18-Dec-13 10:37am    
how can calculate date of Joining....
Maciej Los 18-Dec-13 11:03am    
Have a look at WHERE clause ;)
Maciej Los 18-Dec-13 11:03am    
+5!
CREATE TABLE #EMP(EmpID INT,EmpName VARCHAR(50),Salary MONEY,DOJ DATE);

INSERT INTO #EMP VALUES(1215,'HARISH',20000,'23-MAY-2015'),
                       (1234,'SaiKiran',30000,'23-DEC-2013'),
		       (1234,'SatishREDDY',15000,'05-AUG-2016'),
		       (1234,'Santosh',25000,'03-JUL-2015');

  UPDATE #EMP  
     SET Salary=salary+Salary*.15 
           WHERE DATEDIFF(YEAR,DOJ,GETDATE())=2;

SELECT * FROM #EMP;
----------------------------------------------
EmpID	EmpName	      Salary	DOJ
-----------------------------------------------
1215	HARISH	     23000.00	2015-05-23
1234	SaiKiran     30000.00	2013-12-23
1234	SatishREDDY  15000.00	2016-08-05
1234	Santosh	     28750.00	2015-07-03
 
Share this answer
 
Comments
CHill60 18-Nov-17 4:41am     CRLF
Question was asked and answered 4 years ago! You have added nothing new to the thread. Stick to answering new questions where the OP still needs help
Santosh kumar Pithani 18-Nov-17 5:44am    
Sure :)
SQL
SELECT salary + (salary * 15/100) as Salary, emp_name
FrOM employee_info
Where DATEDIFF(MONTH, dateofjoin, GETDATE())/12 =2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900