반응형

[mssql]  숫자 앞에 0 으로 채우기, Replicate

 


-- 2013-9-2
select YEAR(getDate()), Month(getdate()), day(getdate())


-- 2013-09-02
select YEAR(getDate()), replicate('0',2 - len(Month(getdate()))) + cast(Month(getdate()) as varchar), replicate('0',2 - len(day(getdate()))) + cast(day(getdate()) as varchar)

반응형

+ Recent posts