FINDFIRST & SETCURRENTKEY

Remco
Remco Member Posts: 81
Do you still need to use SETCURRENTKEY with the FINDFIRST, FINDLAST and FINDSET statement?

Comments

  • markborges
    markborges Member Posts: 170
    Which version of Navision supports these statements?

    :wink:
    Marcelo Borges
    D365 Business Central Solutions Architect
    BC AL/NAV C/AL Developer
    BC Repositories.com
  • Waldo
    Waldo Member Posts: 3,412
    On Native: always use it (ISAM)
    On SQL: use SETCURRENTKEY to retrieve the recordset in an ordered way. SQL doesn't use it to fetch the data.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • Mbad
    Mbad Member Posts: 344
    Yes and 4.0 SP2+
  • kriki
    kriki Member, Moderator Posts: 9,121
    Remco wrote:
    Do you still need to use SETCURRENTKEY with the FINDFIRST, FINDLAST and FINDSET statement?
    Depends in which order you want the records.
    On SQL, it serves ONLY to define the order.
    On Navision it serves to select the correct key for performance (and also ordering).
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Waldo
    Waldo Member Posts: 3,412
    so I was right?
    :wink:

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • kriki
    kriki Member, Moderator Posts: 9,121
    Waldo wrote:
    so I was right?
    :wink:
    Yes, I just refrased it :wink:
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Remco
    Remco Member Posts: 81
    So, does this mean that with using a FINDFIRST in a batchproces it is of no use to add a SETCURRENTKEY to make this batchproces faster.
  • kine
    kine Member Posts: 12,562
    You can hint SQL server through SETCURRENTKEY (for example, he can change the execution schema when SQL knows that you want to order the set in some way...).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.