Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Use of ForceLiterals, ForcePlaceholders

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Use of ForceLiterals, ForcePlaceholders

    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.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Use of ForceLiterals, ForcePlaceholders

    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

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Use of ForceLiterals, ForcePlaceholders

    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.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,820 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,514 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans