Skip to main content

Notifications

Community site session details

Community site session details

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

Slowness when making scans for items at points of sale

(0) ShareShare
ReportReport
Posted on by 10

i'm currently having this issue and It slows down the points of sale. could you please share with me, how can this be resolved?

ApplySessionFileToClientDatabase encountered Exception. Error Details: Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.ProcessTargetRequestHeaderException: ProcessTargetRequestHeader failed to execute all write requests. ---> Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.ProcessWriteRequestException: Write request on table:[ax].[RETAILPERIODICDISCOUNTLINE] failed to execute. ---> Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.RunException: Run() failed while performing write operation on table. ---> Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.PerformWriteOperationException: Query: MERGE [ax].[RETAILPERIODICDISCOUNTLINE] AS dst
USING (SELECT [DISCOUNTPERCENTORVALUE],[INSTANCERELATIONTYPE],[ISDISCOUNTCODEREQUIRED],[LINENUM],[NAME],[OFFERID],[RECID],[RELATIONTYPE],[RETAILGROUPMEMBERLINE],[STATUS],[UNITOFMEASURE],[DATAAREAID] FROM [#ax_RETAILPERIODICDISCOUNTLINE_82ad1355-3c46-47c6-b3bf-31afb83bf801]) AS src
ON (dst.[RECID]=src.[RECID])
WHEN MATCHED THEN
UPDATE SET [DISCOUNTPERCENTORVALUE]=src.[DISCOUNTPERCENTORVALUE],[INSTANCERELATIONTYPE]=src.[INSTANCERELATIONTYPE],[ISDISCOUNTCODEREQUIRED]=src.[ISDISCOUNTCODEREQUIRED],[LINENUM]=src.[LINENUM],[NAME]=src.[NAME],[OFFERID]=src.[OFFERID],[RELATIONTYPE]=src.[RELATIONTYPE],[RETAILGROUPMEMBERLINE]=src.[RETAILGROUPMEMBERLINE],[STATUS]=src.[STATUS],[UNITOFMEASURE]=src.[UNITOFMEASURE],[DATAAREAID]=src.[DATAAREAID]
WHEN NOT MATCHED THEN
INSERT ([DISCOUNTPERCENTORVALUE],[INSTANCERELATIONTYPE],[ISDISCOUNTCODEREQUIRED],[LINENUM],[NAME],[OFFERID],[RECID],[RELATIONTYPE],[RETAILGROUPMEMBERLINE],[STATUS],[UNITOFMEASURE],[DATAAREAID])
VALUES (src.[DISCOUNTPERCENTORVALUE],src.[INSTANCERELATIONTYPE],src.[ISDISCOUNTCODEREQUIRED],src.[LINENUM],src.[NAME],src.[OFFERID],src.[RECID],src.[RELATIONTYPE],src.[RETAILGROUPMEMBERLINE],src.[STATUS],src.[UNITOFMEASURE],src.[DATAAREAID]);
DROP TABLE [#ax_RETAILPERIODICDISCOUNTLINE_82ad1355-3c46-47c6-b3bf-31afb83bf801];
---> System.Data.SqlClient.SqlException: Violation of UNIQUE KEY constraint 'I_-2095525985_1217888543'. Cannot insert duplicate key in object 'ax.RETAILPERIODICDISCOUNTLINE'. The duplicate key value is (NS-000010, 0.4375000335276130, ns).
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.PerformWriteOperation(SqlConnection connection, SqlTransaction transaction)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.PerformWriteOperation(SqlConnection connection, SqlTransaction transaction)
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.Run(SqlConnection connection, SqlTransaction transaction)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.Run(SqlConnection connection, SqlTransaction transaction)
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessWriteRequest(SqlConnection connection, SqlTransaction transaction)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessWriteRequest(SqlConnection connection, SqlTransaction transaction)
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessTargetRequestHeader(ISCTargetRequestHeader targetRequestHeader)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessTargetRequestHeader(ISCTargetRequestHeader targetRequestHeader)
at Microsoft.Dynamics.Retail.SynchClient.Core.DownloadAgent.ApplySessionFileToClientDatabase(SessionManager sessionMgr, String fileName)Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.ProcessTargetRequestHeaderException: ProcessTargetRequestHeader failed to execute all write requests. ---> Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.ProcessWriteRequestException: Write request on table:[ax].[RETAILPERIODICDISCOUNTLINE] failed to execute. ---> Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.RunException: Run() failed while performing write operation on table. ---> Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.PerformWriteOperationException: Query: MERGE [ax].[RETAILPERIODICDISCOUNTLINE] AS dst
USING (SELECT [DISCOUNTPERCENTORVALUE],[INSTANCERELATIONTYPE],[ISDISCOUNTCODEREQUIRED],[LINENUM],[NAME],[OFFERID],[RECID],[RELATIONTYPE],[RETAILGROUPMEMBERLINE],[STATUS],[UNITOFMEASURE],[DATAAREAID] FROM [#ax_RETAILPERIODICDISCOUNTLINE_82ad1355-3c46-47c6-b3bf-31afb83bf801]) AS src
ON (dst.[RECID]=src.[RECID])
WHEN MATCHED THEN
UPDATE SET [DISCOUNTPERCENTORVALUE]=src.[DISCOUNTPERCENTORVALUE],[INSTANCERELATIONTYPE]=src.[INSTANCERELATIONTYPE],[ISDISCOUNTCODEREQUIRED]=src.[ISDISCOUNTCODEREQUIRED],[LINENUM]=src.[LINENUM],[NAME]=src.[NAME],[OFFERID]=src.[OFFERID],[RELATIONTYPE]=src.[RELATIONTYPE],[RETAILGROUPMEMBERLINE]=src.[RETAILGROUPMEMBERLINE],[STATUS]=src.[STATUS],[UNITOFMEASURE]=src.[UNITOFMEASURE],[DATAAREAID]=src.[DATAAREAID]
WHEN NOT MATCHED THEN
INSERT ([DISCOUNTPERCENTORVALUE],[INSTANCERELATIONTYPE],[ISDISCOUNTCODEREQUIRED],[LINENUM],[NAME],[OFFERID],[RECID],[RELATIONTYPE],[RETAILGROUPMEMBERLINE],[STATUS],[UNITOFMEASURE],[DATAAREAID])
VALUES (src.[DISCOUNTPERCENTORVALUE],src.[INSTANCERELATIONTYPE],src.[ISDISCOUNTCODEREQUIRED],src.[LINENUM],src.[NAME],src.[OFFERID],src.[RECID],src.[RELATIONTYPE],src.[RETAILGROUPMEMBERLINE],src.[STATUS],src.[UNITOFMEASURE],src.[DATAAREAID]);
DROP TABLE [#ax_RETAILPERIODICDISCOUNTLINE_82ad1355-3c46-47c6-b3bf-31afb83bf801];
---> System.Data.SqlClient.SqlException: Violation of UNIQUE KEY constraint 'I_-2095525985_1217888543'. Cannot insert duplicate key in object 'ax.RETAILPERIODICDISCOUNTLINE'. The duplicate key value is (NS-000010, 0.4375000335276130, ns).
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.PerformWriteOperation(SqlConnection connection, SqlTransaction transaction)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.PerformWriteOperation(SqlConnection connection, SqlTransaction transaction)
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.Run(SqlConnection connection, SqlTransaction transaction)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlWriteRequestRunner.Run(SqlConnection connection, SqlTransaction transaction)
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessWriteRequest(SqlConnection connection, SqlTransaction transaction)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessWriteRequest(SqlConnection connection, SqlTransaction transaction)
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessTargetRequestHeader(ISCTargetRequestHeader targetRequestHeader)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.SCSqlTargetRequestHandler.ProcessTargetRequestHeader(ISCTargetRequestHeader targetRequestHeader)
at Microsoft.Dynamics.Retail.SynchClient.Core.DownloadAgent.ApplySessionFileToClientDatabase(SessionManager sessionMgr, String fileName)

  • Mostafa Sadek Profile Picture
    10 on at
    RE: Slowness when making scans for items at points of sale

    This happens sometimes during the sale, not all the time, and this error always appears event viewer

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,125 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,871 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans