× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Carel,

Hausser option is more better, because I need just One Leading Zero, while
DIGITS function will put 10 leading zeros behind month.

Thanks to all of you.

Best Regards,

Luqman

"Carel Teijgeler" <coteijgeler@xxxxxxxxx>
wrote in message news:200506262224390610.0007AF20@xxxxxxxxxxxxxxxxx
Would not the following statement do the same?

CHAR(DIGITS(MONTH(CURRENT DATE)),2)

Regards,
Carel Teijgeler

*********** REPLY SEPARATOR  ***********

On 26-6-05 at 16:33 HauserSSS wrote:

>Hi,
>
>if you use the SQL scalar function MONTH the return value is a numeric
>value
>and not a character string.
>You have to convert the numeric value into a character string and depending
>on its length, you add the leading zero or not.
>
>Select case when month(current_date) < 10 then '0' else '' End
>       concat Char(Month(Current_Date))
>  from sysibm.sysdummy1
>
>Birgitta
>
>-----Ursprüngliche Nachricht-----
>Von: rpg400-l-bounces@xxxxxxxxxxxx
>[mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag
von Luqman
>Gesendet: Sonntag, 26. Juni 2005 14:35
>An: rpg400-l@xxxxxxxxxxxx
>Betreff: Putting Leading Zeros in Sql ?
>
>
>How to put leading zeros in sql ?
>
>For example:
>
>if current date is : 1st June 2005
>Select month(current date) from sysibm.sysdummy1
>is returning 6, when I need this to be '06'.
>
>Any idea please ?
>
>Best Regards,
>
>Luqman
>
>
>
>
>--
>This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
>To post a message email: RPG400-L@xxxxxxxxxxxx
>To subscribe, unsubscribe, or change list options,
>visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
>or email: RPG400-L-request@xxxxxxxxxxxx
>Before posting, please take a moment to review the archives
>at http://archive.midrange.com/rpg400-l.
>
>
>
>-- 
>This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
>To post a message email: RPG400-L@xxxxxxxxxxxx
>To subscribe, unsubscribe, or change list options,
>visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
>or email: RPG400-L-request@xxxxxxxxxxxx
>Before posting, please take a moment to review the archives
>at http://archive.midrange.com/rpg400-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.