I want to append 0 to my minute(mi) result returned by DATENAME function of sql server management studio.
select datename(mi,GETDATE())
If the current time where 12:06:33.12(hh:mi:ss) then '6' would be returned by the above query and I want 0 to be prefixed with the result i.e '06' only when my minute is less than 10.
This can be easily done by branching and checking the result obtained by above query and seeing if it is less than 10 i.e using a CASE statement.Is there a much cleaner way to do the job without branching?