On Feb 8, 2008 9:35 AM, Lettau, Jeff <[EMAIL PROTECTED]> wrote:

> The question is when I do
> OCONV(@DATE, 'DM') I get 02 but when I do OCONV(@DATE, 'DM')-1 I get 1 not
> 01.
> Why?  And how do I get these to match?


Because the result of the OCONV(@DATE,'DM') is a string with two characters
and when you do a mathematical operation on it (-1) it converts to a number
and the leading zeroes are removed.  To make it two characters

OCONV(OCONV(@DATE,'DM') - 1),'MR%2')

I'll take a better solution if someone has it since I have to do this for 36
> months making 36 i-desc to put it in columns for my output that will need
> to
> be grouped and summed.


Alternatively, add 0 to the original date conversion:

OCONV(@DATE,'DM') + 0

...and then you can compare strictly numerically without the leading digits.

-K2
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to