0

I want to convert string column of format 'mm-yyyy' to timestamp.

Meet Patel
  • 59
  • 2
  • 12

1 Answers1

0

Try this following logic. As you have only Month and Year value in your string, I have added the static date 01 to each date to generate the DATETIME value.

select 
CAST(
    CONCAT(right('06-2019',4) , '-', left('06-2019', 2),'-01') AS DATETIME
);
mkRabbani
  • 16,295
  • 2
  • 15
  • 24