How do I get the month and day with leading 0's in SQL? (e.g. 9 => 09)

前端 未结 11 1142
旧巷少年郎
旧巷少年郎 2020-12-08 06:03
DECLARE @day CHAR(2)

SET @day = DATEPART(DAY, GETDATE())

PRINT @day

If today was the 9th of December, the above would print \"9\".

I want

11条回答
提交回复
热议问题