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.
Author |
Topic |
mateenmohd
Constraint Violating Yak Guru
297 Posts |
Posted - 2004-03-06 : 03:27:58
|
How can calculate the No of days between two dates in sql query analyzer ?Ie.select day(enddate-startdate) NOOFDAYS from tablenameRegards.Mateen |
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2004-03-06 : 03:39:27
|
Look up the DATEDIFF function in Books Online. Basically you can say:SELECT DATEDIFF(d, StartDate, EndDate) AS NoOfDays FROM TableNameThe function also lets you specify the intervals you want returned, i.e. days, months, years, etc.OS |
|
|
mateenmohd
Constraint Violating Yak Guru
297 Posts |
Posted - 2004-03-06 : 03:55:48
|
thanks.quote: Originally posted by mohdowais Look up the DATEDIFF function in Books Online. Basically you can say:SELECT DATEDIFF(d, StartDate, EndDate) AS NoOfDays FROM TableNameThe function also lets you specify the intervals you want returned, i.e. days, months, years, etc.OS
|
|
|
|
|
|