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
Select Replicate('0',2 - DataLength(Convert(VarChar(2),DatePart(DAY, GetDate()))) + Convert(VarChar(2),DatePart(DAY, GetDate())
Far neater, he says after removing tongue from cheek.
Usually when you have to start doing this sort of thing in SQL, you need switch from can I, to should I.