web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

AX 2012 R3 Data Upgrade to Dynamics 365 Finance and Operations PU 35 Step 9 - Error

(0) ShareShare
ReportReport
Posted on by 446

Hi,

We are upgrading data from AX 2012 R3 CU13 to Dynamics 365 Finance and Operations. The data upgrade package fails at step no# 9 (postsync for data upgrade).

We found that this step is running a power shell script called (AutoDataUpgradePostSync.ps1), after failure we checked ReleasUpdateScriptErrorLog table and found the following error:

CLASSNAME: ReleaseUpdateDB72_Project

METHODNAME: UpdateProjCostTransWorkerToResource

Cannot select a record in Expense (ProjCostTrans). Project date: . The SQL database has issued an error. Object Server DynamicsAXBatchManagement:  [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword 'FROM'. SELECT  FROM PROJCOSTTRANS T1 WHERE (((PARTITION=?) AND (DATAAREAID=?)) AND 1=?) GROUP BY T1.DATAAREAID ORDER BY T1.DATAAREAID session 12 (Admin) Batch task failed: Cannot select a record in Expense (ProjCostTrans). Project date: . The SQL database has issued an error.

We checked this method as shown below and it seems to be OK, We don't know how is the syntax incorrect !! How to fix!! Is it a bug from Microsoft side!!

Please advise and thanks

/// <summary>
/// Convert the worker field to resource for <c>projCostTrans</c> table.
/// </summary>
[UpgradeScriptDescriptionAttribute("@ProjDataUpgrade72:UpgradeWorkerToResourceForProjCostTrans"),
UpgradeScriptConfigKeyAttribute(configurationKeyStr(Project)),
UpgradeScriptStageAttribute(ReleaseUpdateScriptStage::PostSync),
UpgradeScriptTypeAttribute(ReleaseUpdateScriptType::StandardScript),
UpgradeScriptTableAttribute(tableStr(ProjCostTrans), false, true, true, false),
UpgradeScriptTableAttribute(tableStr(ResResourceIdentifier), true, true, false, false),
UpgradeScriptTableAttribute(tableStr(WrkCtrTable), true, true, false, false),
UpgradeScriptTableAttribute(tableStr(HcmWorker), false, true, false, false),
UpgradeScriptTableAttribute(tableStr(CompanyInfo), false, true, false, false),
UpgradeDependsOnTaskAttribute(methodStr(ReleaseUpdateDB72_Project, updateProjCostSalesPriceWorkerToResource))]
public void updateProjCostTransWorkerToResource()
{
ProjCostTrans projCostTrans;
ProjCostTrans updateTable;

this.callInsertUpdateRelatedSkipMethods(updateTable);

// Update for the case of fields Worker and WorkerLegalEntity fields are not 0.
while select Worker, WorkerLegalEntity from projCostTrans
group by Worker, WorkerLegalEntity
where projCostTrans.Worker != 0
&& projCostTrans.WorkerLegalEntity != 0
{
RefRecId resoruceLegalEntity = projCostTrans.WorkerLegalEntity;
RefRecId resource = ReleaseUpdateDB72_Project::findOrCreateByWorker(projCostTrans.Worker, resoruceLegalEntity);
update_recordset updateTable
setting Resource = resource
where updateTable.Worker == projCostTrans.Worker
&& updateTable.WorkerLegalEntity == resoruceLegalEntity;
}

// Update for the case of fields Worker is not 0 and WorkerLegalEntity is 0.
while select Worker, DataAreaId from projCostTrans
group by Worker, DataAreaId
where projCostTrans.Worker != 0
&& projCostTrans.WorkerLegalEntity == 0
{
RefRecId resoruceLegalEntity = CompanyInfo::findDataArea(projCostTrans.DataAreaId).RecId;
RefRecId resource = ReleaseUpdateDB72_Project::findOrCreateByWorker(projCostTrans.Worker, resoruceLegalEntity);
update_recordset updateTable
setting Resource = resource
where updateTable.Worker == projCostTrans.Worker
&& updateTable.WorkerLegalEntity == 0
&& updateTable.DataAreaId == projCostTrans.DataAreaId;
}
}

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at

    Hi Peter,

    The SQL statement indeed has an issue. It should have a list of fields or a wildcard to retrieve all fields. I can't find quickly a related known issue on LCS issue search. If you don't have customizations in this area on AX2012 or Dynamics 365, I would suggest to create a ticket for Microsoft Support.

  • Peter Samir Profile Picture
    446 on at

    Hi Andre,

    Actually, we have customizations into this table as we added several fields.

    Is it causing an incorrect SQL syntax?? If yes, what is the area that i have to investigate??

  • André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at

    Hi Peter,

    When I read the method you provided, then I don't think the custom fields itself should be the culprit. Are you sure that the environment is built correctly and that a DB sync was completed successfully?

  • Peter Samir Profile Picture
    446 on at

    Hi Andre,

    The data upgrade deployable package consists of several steps and step number 8 was (db sync data upgrade) and it was completed successfully. But I didn't build the whole environment before running the data upgrade deployable package.

    I debugged step number 9 and we discovered that the exception error exists at class\ReleaseUpdateDB72_Project\UpdateProjCostTransWorkerToResource  which is included into data upgrade model so I build this model only and tried again but the error still exist.

    4370.Error.png

    Cannot select a record in Expense (ProjCostTrans). Project date: . The SQL database has issued an error. Object Server DynamicsAXBatchManagement:  [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword 'FROM'. SELECT  FROM PROJCOSTTRANS T1 WHERE (((PARTITION=?) AND (DATAAREAID=?)) AND 1=?) GROUP BY T1.DATAAREAID ORDER BY T1.DATAAREAID session 12 (Admin) Batch task failed: Cannot select a record in Expense (ProjCostTrans). Project date: . The SQL database has issued an error.

    I don't know how the SQL syntax is incorrect although the X++ code is correct, Do you have any suggestion?

  • Peter Samir Profile Picture
    446 on at

    Build all models with references didn't solve our issue.

  • WillWU Profile Picture
    22,361 on at

    Hi Peter,

    Please have a look at this:

    docs.microsoft.com/.../upgrade-data-to-latest-update

    Hope this helps.

  • Odaihoseh Profile Picture
    50 on at

    Hello Peter , Did you find any solution for this issue ? 

  • Verified answer
    Peter Samir Profile Picture
    446 on at

    Hi Odai,

    Yes, I opened a support ticket with Microsoft and it was an issue solved by KB4563461.

    1.Rollback the current upgrade

    2.Download latest AX2012DataUpgrade-10-0-11

    3.Install all updates available under Quality Updates - including KB4563461

    4.Run AXDataUpgrade again.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans