cheryl9063
asked on
SQL date syntax
How do I create this 08,2012?.. The month has to be 2 digits
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the grade. Good luck with your project. -Jim
Declare @dt datetime = GETDATE()
SELECT 'Month with a leading zero', CONVERT(VARCHAR(2), @dt,101), RIGHT('0' + CAST(Month(@dt) as varchar(2)), 2)
Are you trying to return MM{comma}YYYY?