A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
Hi @Lora
Refering from this doc:
Return Value The int difference between the startdate and enddate, expressed in the boundary set by datepart.
You could modify the datepart from hour to second and then divide by 3600.
Like this: select cast(datediff(s,'2023-12-28 09:00:00', '2023-12-28 18:30:00') as float) / 3600
Best regards,
Cosmog Hong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.