I tried with SQL below to combine the empid with Active which as when I combine both column MTHID show me different results.
SELECT CASE
WHEN len(month([Active])) =1
THEN empid+ concat(year([Active]),'0',month([Active]))
ELSE concat(year([Active]),month([Active]))
END as MonthID, *
FROM MY_CATW
MTHID EMPID
20212341 20010940
20212341 20010940
With below SQL which I did not combine it appears correctly, so I expect when we combine both column it should have result like 20010940201401
SELECT CASE
WHEN len(month([Active])) =1
THEN concat(year([Active]),'0',month([Active]))
ELSE concat(year([Active]),month([Active]))
END as MonthID, *
FROM MY_CATW
MTHID EMPID
201401 20010940
201401 20010940
Open in new window
See http://sqlfiddle.com/#!6/297f0/2