Hi All,
can someone explain the use of ForceLiterals, ForcePlaceholders keywords in AX.
When should we use these keywords?
Regards,
Nunna.
*This post is locked for comments
Hi All,
can someone explain the use of ForceLiterals, ForcePlaceholders keywords in AX.
When should we use these keywords?
Regards,
Nunna.
*This post is locked for comments
As per MSDN documents you are not advised to use ForceLiterals keywords as it may expose code to an SQL Injection threat. It reveals physical values of where clause.
ForcePlaceholders hide physical values, moreover its default parameter.
Please review following link for most comprehensive details
msdn.microsoft.com/.../aa656402.aspx
forceLiterals and forcePlaceholders are mutually exclusive.
please verify and update us if this helps you
Hi Nunna,
In order to use these keywords, you should have a good understanding of SQL execution plans and option clause. There are many good blog posts which explains these concepts: here are some good reads.
https://fredshen.wordpress.com/2006/01/02/forceliterals-forceplaceholders/
http://www.databaseskill.com/675246/
We do not see extensive use of these keywords in AX. If you scan the AOT you might find only couple of instances where these keywords are used for example :
\Classes\ReleaseUpdateDB60_Ledger\updateTaxTransGeneralJournalAccountEntry()
\Data Dictionary\Tables\ReqTrans\Methods\bulkInitFromInventTransOrigin()
Unless you have a very good understanding of SQL server execution plans , leave it to the SQL server to select it's own plan as SQL server query optimizer may pick a plan that is targeting to return a few rows quickly, rather than a plan that will minimize the total result set retrieval.
Hope this help.
André Arnaud de Cal... 291,820 Super User 2024 Season 2
Martin Dráb 230,514 Most Valuable Professional
nmaenpaa 101,156