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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 dates

Author  Topic 

wided
Posting Yak Master

218 Posts

Posted - 2011-06-29 : 11:16:16
I have 2 dates, I want to know the duration in years (Presice)

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-06-29 : 11:22:57
Depends on what you mean.
A datediff will give you the number of end of years bewteen them.
You can then add/subtract 1 depending on the day number in the year.

Could take the number of days and divide by 365.25 (ish)

How many years between feb 29th one year and Feb 28th the next?


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

wided
Posting Yak Master

218 Posts

Posted - 2011-06-29 : 12:56:03
yes, thanks
Go to Top of Page
   

- Advertisement -