Can i lesser this User defined functioni need to validate the time if the hour is < 8:16 it will return a value of '8:00 AM' otherwise same value of 8:16 will be return??DECLARE @rtime DATETIMEDECLARE @rvalue DATETIMEIF DATEPART(hh,@rtime) <= 8BEGINIF DATEPART(hh,@rtime) = 8BEGINIF DATEPART(mi,@rtime) < 16BEGINSET @rvalue = CAST('8:00 AM' AS DATETIME)ENDELSEBEGINSET @rvalue = @rtimeEND END ELSEBEGINSET @rvalue = @rtimeEND END RETURN @rvalue
A maze make you much more better