case when cast(ASKME_CREAT_TM as time) between cast('08:00:00' as time) and cast('12:00:00' as time) then 'AM' else 'unkown' end,
should work as well, so no need for the additional field.
Might be worth to create a SQL UDF out of this - as you would be able to reuse the code easier.
↧