4
I’m trying to leave the period from 201601 to 20161 in SQL, but I can not at all!
I wonder if someone could help me?
SELECT CONVERT(NUMERIC(5), CONVERT(VARCHAR(4), YEAR(Periodo_Mensal))+
CONVERT(VARCHAR(4), MONTH(Periodo_Mensal))) AS PERIODO_MENSAL
I tried the LEN
, tried the REPLACE
, but nothing certain.
select left('201601', 4) + right('201601', 1)
– Sorack
Where I fit this select?
– tcm
I edited my answer
– Sorack
@tcm, what is sgbd? There are functions that facilitate conversion of dates, but that vary from sgbd to sgbd.
– José Diz
Sqlserver is the SGBD
– Sorack