Click here to Skip to main content
15,891,730 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a table emp columns are (name,id,hiredate,sal)

my question is i need experience of emp ?

can you please help me
Posted
Comments
[no name] 25-Feb-15 7:08am    
Where should the experience come from if it's not in one of the tables columns?
Rajesh waran 25-Feb-15 7:12am    
If you want to calculate Years of experience from Hiredate to Current date, try like this,
select DATEDIFF(YEAR,hiredate,GETDATE()) from emp
samtumma113 Reddy 25-Feb-15 7:54am    
thank u bro
Rajesh waran 25-Feb-15 7:56am    
You're Welcome.

1 solution

Use DateDiff function to find out difference between getdate() and hiredate

http://www.mssqltips.com/sqlservertip/2508/sql-server-datediff-example/[^]
 
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