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 :
Small and medium business | Business Central, N...
Suggested Answer

Sync-NavApp Issue where the SQL query running in back end is Suspended

(5) ShareShare
ReportReport
Posted on by 16
Hi,
I am getting an issue on upgrading from BC14 Spring to BC25 on-premise. Eventually the database will go to a SaaS environment. I am in the process of moving the C/AL to AL and I am executing the Synch-NavApp command in Task 14 (The second version of the Empy Migration App): 
 
 
Sync-NAVApp -ServerInstance BC252 -Tenant Default -Name "bc14baseapptablesonly" -Version 2.0.0.0
 
This is moving data from the Main table to the Base tables and the Extension tables. After about 20 mins the SQL query on the back end is in a suspended state and when run a few times it always stops at this query:
 
MERGE INTO "dbo"."MyCOMPANY$G_L Entry$437dbf0e-84ff-417a-965d-ed2bb9650972$ext" AS [dst] USING "dbo"."TEMP$MyCOMPANY$G_L Entry$7842b442-a286-4b31-a2d9-553216ee8bed" AS [src] ON "dst"."Entry No_" = "src"."Entry No_" WHEN MATCHED THEN UPDATE SET "Entry No_" = "src"."Entry No_", "Member No_ TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa" = "src"."Member No_", "Shortcut Dimension 3 Code TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa" = "src"."Shortcut Dimension 3 Code", "Shortcut Dimension 4 Code TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa" = "src"."Shortcut Dimension 4 Code", "Description 2 TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa" = "src"."Description 2", "MyCOMPANY D_ Debit Mandate ID TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa" = "src"."MyCOMPANY Direct Debit Mandate ID", "ADDACS Reference Code TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa" = "src"."ADDACS Reference Code", "Service Type TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa" = "src"."Service Type" WHEN NOT MATCHED THEN INSERT ("Entry No_", "Member No_ TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa", "Shortcut Dimension 3 Code TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa", "Shortcut Dimension 4 Code TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa", "Description 2 TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa", "MyCOMPANY D_ Debit Mandate ID TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa", "ADDACS Reference Code TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa", "Service Type TNP$dc94960c-1fc9-45c6-9350-90a9544fb0aa") VALUES ("src"."Entry No_", "src"."Member No_", "src"."Shortcut Dimension 3 Code", "src"."Shortcut Dimension 4 Code", "src"."Description 2", "src"."MyCOMPANY Direct Debit Mandate ID", "src"."ADDACS Reference Code", "src"."Service Type");
 
I extract the above using this SQL query:
SELECT sqltext.TEXT,
req.session_id,
req.status,
req.command,
req.cpu_time,
req.total_elapsed_time
FROM sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext
 
I have no idea if it is actually this query causing the issue or anything else. All my empty apps and BC25 Apps are synchronised. 
 
I have checked all Empty extensions and Custom Extensions and all look good and all the fields exist. Has anyone come across this or can advise?
I have the same question (0)
  • Suggested answer
    OussamaSabbouh Profile Picture
    5,648 on at
    Hello,
     
    The MERGE is stuck because SQL is waiting, usually from blocking or missing indexes on "Entry No_".
     
    Ensure no other sessions access the DB.
     
    Add an index on "Entry No_" in the temp table.
     
    Update stats (EXEC sp_updatestats;).
     
    Then rerun Sync-NAVApp.
     
    Regards,
    Oussama Sabbouh
  • MH-07111709-0 Profile Picture
    16 on at
    @OussamaSabbouh Thanks for this. Currently there are 3 tables created as part of the C/AL to AL data conversion. These are with the following keys:
     
     
    That all seems good to me so not sure what you mean to create an index on the temp table. 

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans