Sunday, July 10, 2011

Manually upgrade Date and Time fields

after an AX2009 upgrade, if you happen to forget to upgrade a Date and
Time field combination on a table to the new DateTime field, use this
simple job.

in the case below, SysDatabaseLog's CreatedTime did not seem to be
upgraded to be incorporated into the new CreatedDateTime field.

=======

static void AX2009Upgrade_ManuallyUpgradeDateTime(Args _args)
{
DEL_SysUpgradeTimeZone listOfColumnsToBeUpgraded;
ReleaseUpdateDB_TimezoneUpgrade timezoneUpgradeClass;
;

ReleaseUpdateDB41_Basic::upgradeToDateTime
(
tablenum(SysDatabaseLog),

fieldnum(SysDatabaseLog, CreatedDateTime),

fieldnum(SysDatabaseLog, CreatedDateTime),

fieldnum(SysDatabaseLog, DEL_CreatedTime)
);

while
select
listOfColumnsToBeUpgraded
order by
listOfColumnsToBeUpgraded.RefTableId
where
listOfColumnsToBeUpgraded.Status == SysUpgradeTimeZoneStatusEnum::Ready
{
timezoneUpgradeClass =
ReleaseUpdateDB_TimezoneUpgrade::construct(
listOfColumnsToBeUpgraded.data() );
timezoneUpgradeClass.run();
}
pause;
}

No comments:

Post a Comment