Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is datetime more than 48 hours ago?
Message
De
23/01/2017 13:10:01
 
 
À
23/01/2017 13:00:56
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2012
Divers
Thread ID:
01646961
Message ID:
01646966
Vues:
25
>I see you adjusted to DateDiff(). Yes, that would be the approach to go. I have a similar process and that is the best I have found sofar. The usage of Second() is also a good fit. To handle the decimals, I ended up with something like this:
>
>
>SELECT COALESCE(SUM(Temp.[Second])/3600.0,0)
> FROM (SELECT DATEDIFF(SECOND,
> CASE WHEN BusinessTime.Start>Client.AddDate THEN BusinessTime.Start ELSE Client.AddDate END,
> CASE WHEN BusinessTime.[End]<Client.FirstContactDate THEN BusinessTime.[End] ELSE Client.FirstContactDate END) AS [Second]
> FROM BusinessTime
> WHERE BusinessTime.Start<Client.AddDate AND
> BusinessTime.[End]>=Client.FirstContactDate) Temp
>
>
>This is basically and adaption of what it is actually. But, that should give you an idea on the DateDiff() usage with Second, which is then divided by 3600. In my case, I wanted to have that in hours. So, that changed the decimal value into hours, which has decimal support with the ,0.

Thanks
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform