Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning DATEDIFF Value As hh:mm:ss
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00635803
Message ID:
00635827
Vues:
15
>It's easier.
>declare @dtStart datetime
>declare @dtEnd datetime
>set @dtstart = '01/01/2002 9:00:00'
>set @dtEnd = '01/03/2002 8:09:00'
>SELECT CAST(DATEDIFF(second, @dtStart, @dtEnd)*1.00/3600 AS numeric(10,2))
>
>-- or
>SELECT CAST(DATEDIFF(hh, @dtStart, @dtEnd) AS varchar(4) ) +
> RIGHT(CONVERT(char(8), DATEADD(second, DATEDIFF(second, @dtStart, @dtEnd), '20020101'), 8),6)

Excellent! Wonderful! Fast! You did it both ways!

Thank you so much.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform