jeudi 9 avril 2020

SQL compare datetime column with specific hour and minute time range

I need write a CASE statement like below;

Datetime column: '2020-04-09 08:34:00.000'

I don't care year,month,day parts. Just want to compare hour and minutes part with specific hour and minute.

If hh:mm parts of datetime value between '05:30' and '15:30' Then 1

If hh:mm parts of datetime value between '15:31' and '05:29' Then 2

How can i achieve this?

Aucun commentaire:

Enregistrer un commentaire