Question : Basic SQL question

Hello Experts,
My query is like below:

Select RIGHT('00' + datepart(month,dteOperation),2) from salestransactions
------------------------
The months in the resultset still appear one digit. But my purpose is show them as 2 digits.

Any idea?

Answer : Basic SQL question

The problem is you are working with both a text string and a numeric value around the + operator, and SQL seems to be yielding a result as a number, not text.  I think this will give you what you want.

Select RIGHT('00' + convert(varchar, datepart(month,dteOperation)), 2) from salestransactions

~bp
Random Solutions  
 
programming4us programming4us