|
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.
As an Amazon Associate we earn from qualifying purchases.
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.