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 2000 Forums
 Transact-SQL (2000)
 Getting days

Author  Topic 

reflex2dotnet
Yak Posting Veteran

99 Posts

Posted - 2007-02-08 : 15:42:46
hello everyone

In my previous quesstion, i have asked for calculating differnece between dates
with the help of members, i use the below select stmt in my SP, and it returns a decimal valu like .865 or .034 for the date difference

How can i get the difference in days?

Stored procedure
select avg(abs(datediff(hour, [table1].[date], [table2].[date])) / 24.0) as [avg in days]

thanks

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-02-08 : 15:59:28
did you look at BOL on datediff?

http://msdn2.microsoft.com/en-us/library/ms189794.aspx

you can pass "day" instead of "hour" to get the day difference. have a look at what's allowed to pass in the first arg: datepart.


www.elsasoft.org
Go to Top of Page
   

- Advertisement -