I am trying to use DatePart to return a two digit hour. I would like to see 01, 02, 03, ...10, 11, 12 for the hours. How can I do this?
if I entered query as,
select DATEPART(hour,'1900-01-01 07:45:00.010')
then I am getting answer 7. I need to get answer as 07.
Try this for MySql or from SQL Server 2012 –
For SQL Server before 2012 –