I want to add a leading zero to a field based on a param that I create on the fly in my stored proc. I have a @.month which is created from my datetime param @.date.
@.Month needs to be char(2) but if the month is inputted as '04' I get '4 ' in the table (note the space after 4)
How can I add a leading zero to this field?
Set @.Year = right('0',1)year(@.Date) is spitting it's toys out.
Thanks,
Brett
prepend a '0' char to the front of it and take RIGHT('0'+yourString,2)
No comments:
Post a Comment