This is an archived course — no longer updated. For current documentation see the official iDempiere docs. Today we help teams migrate from Sage ERP to iDempiere open source ERP — to join the sage.erpcommons.org community, email chuck@racktrust.com. Read the full story.

Update Period Name with YYYY-MM Formatting

--begin;
 update c_period x
 set name = concat_ws('-',y.fiscalyear,lpad(p.periodno::text,2,'0'))
 from c_period p
 join c_year y on p.c_year_id = y.c_year_id
 where y.ad_client_id = 1000000
 and x.c_period_id = p.c_period_id
 ;