Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL function for calculating employment status

Author  Topic 

drazenmd
Starting Member

1 Post

Posted - 2014-05-21 : 18:10:34
Hi,
I need help about writing function in SQL that will return me a period of how long employee is working in a firm, in format yy/mm/dd, based on date of when employee started to work in format yyyy/mm/dd. Let's say that one employee start at 1981/04/21, function should return me 33/01/01, this employee is working 33 years, one month and one day. I don't need to pay attention on leap years, i could take that every month have 30 days.
Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-05-21 : 18:41:54
This is clearly a homework or interview question. Show us what you have so far. We will help, but you need to show some effort. HINT: DATEDIFF.

And your format for output doesn't make sense. Are you sure that's what's wanted?

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -