Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Why Kernel changes the where clause value from navarchar to Number this make query slow .

(0) ShareShare
ReportReport
Posted on by 65

Hello There,

While doing some research I found that the sales id used in the where clause is converted to a Number in SQL query. If we can send it as Nvarchar the query will result faster. I am looking for 

1. Why does AX changes it to Number ?

2. is there a way to change it back to varchar?

X

Select  wmsPickingRoute where wmsPickingRoute.expeditionStatus ==  WMSExpeditionStatus::Complete
                && wmsPickingRoute.transRefId == SalesTable.SalesID;

SQL for above 

SELECT T1.PICKINGROUTEID,
	T1.SHIPMENTID,
	T1.EXPEDITIONSTATUS,
	T1.CUSTOMER,
	T1.TRANSTYPE,
	T1.TRANSREFID,
	T1.HANDLINGTYPE,
	T1.INVENTLOCATIONID,
	T1.VOLUME,
	T1.OPTIMIZEDPICKING,
	T1.EXPECTEDEXPEDITIONTIME,
	T1.PICKINGAREAID,
	T1.PRIORITY,
	T1.STARTDATETIME,
	T1.STARTDATETIMETZID,
	T1.ENDDATETIME,
	T1.ENDDATETIMETZID,
	T1.ACTIVATIONDATETIME,
	T1.ACTIVATIONDATETIMETZID,
	T1.INTERCOMPANYPOSTED,
	T1.SHIPMENTTYPE,
	T1.DLVMODEID,
	T1.DLVTERMID,
	T1.DLVDATE,
	T1.DELIVERYNAME,
	T1.OPERATORWORKER,
	T1.AUTODECREASEQTY,
	T1.PRINTMGMTSITEID,
	T1.PARMID,
	T1.DELIVERYPOSTALADDRESS,
	T1.MCRPICKINGWAVEREF,
	T1.MCRPACKINGBOXNAME,
	T1.MODIFIEDDATETIME,
	T1.MODIFIEDBY,
	T1.MODIFIEDTRANSACTIONID,
	T1.CREATEDDATETIME,
	T1.CREATEDBY,
	T1.CREATEDTRANSACTIONID,
	T1.RECVERSION,
	T1.PARTITION,
	T1.RECID 
FROM WMSPICKINGROUTE T1 
WHERE (((PARTITION=5637144576) 
	AND (DATAAREAID='JM')) 
	AND ((EXPEDITIONSTATUS=10) 
	AND (TRANSREFID=7002109664)))

instead of  (TRANSREFID=7002109664))) in where clause 

(TRANSREFID='7002109664'))) the query is faster .. how can achieve this?

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February 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... 293,099 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,880 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans