I have a column (says Period_name ) that accepts varchar value. Inside the column, I have inputs likeJan-19, Feb-19, etc. I need an SQL instruction whenever left of Period_name comes like Jan, Feb then it should convert into corresponding month number. For example
Input
Period_name
Jan-19
Feb-19
Output
Period name
01
02
The SQL query condition is as follows:
Case
When Left(period_name,3) in{'Jan','Feb'} Then Month(Left(period_name,3))
END
Thanks :)