none
Difference between replace and replace all

    Question

  • Dear all,

               I want to know what is the difference between Replace command and Replace All command. Please help . Thanks.


    hon123456
    Monday, July 12, 2010 3:45 AM

Answers

  • Replace command replaces the current record and replace all replaces all records in a table.

    Please check Help file

    http://msdn.microsoft.com/en-us/library/8ca1stsh(VS.80).aspx

    Pay attention to Scope in the Help:

    Scope

    Specifies a range of records to replace. The default scope for REPLACE is the current record (NEXT 1).

    Only the records that fall within the range are replaced. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. For more information on scope clauses, see Scope Clauses.


    Premature optimization is the root of all evil in programming. (c) by Donald Knuth

    Naomi Nosonovsky, Sr. Programmer-Analyst

    My blog
    Monday, July 12, 2010 3:54 AM
    Moderator
  • Just to add to Naomi's answer, if the REPLACE command has a FOR clause, then ALL is implied as well. That is:

    REPLACE <field> WITH <value> FOR <some condition>

    means to check every record and change all the ones where the condition is true.

    Tamar

    • Marked as answer by Liliane Teng Friday, July 16, 2010 7:23 AM
    Monday, July 12, 2010 8:25 PM
    Answerer
  • To add to Tamar's and Naom's comments, be careful when you use the replace and delete commands, for they are scoped to the currently selected work area. It is always best to use the 'In' clause with both of these commands.

    • Marked as answer by Liliane Teng Friday, July 16, 2010 7:24 AM
    Tuesday, July 13, 2010 1:28 AM

All replies

  • Replace command replaces the current record and replace all replaces all records in a table.

    Please check Help file

    http://msdn.microsoft.com/en-us/library/8ca1stsh(VS.80).aspx

    Pay attention to Scope in the Help:

    Scope

    Specifies a range of records to replace. The default scope for REPLACE is the current record (NEXT 1).

    Only the records that fall within the range are replaced. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. For more information on scope clauses, see Scope Clauses.


    Premature optimization is the root of all evil in programming. (c) by Donald Knuth

    Naomi Nosonovsky, Sr. Programmer-Analyst

    My blog
    Monday, July 12, 2010 3:54 AM
    Moderator
  • Just to add to Naomi's answer, if the REPLACE command has a FOR clause, then ALL is implied as well. That is:

    REPLACE <field> WITH <value> FOR <some condition>

    means to check every record and change all the ones where the condition is true.

    Tamar

    • Marked as answer by Liliane Teng Friday, July 16, 2010 7:23 AM
    Monday, July 12, 2010 8:25 PM
    Answerer
  • To add to Tamar's and Naom's comments, be careful when you use the replace and delete commands, for they are scoped to the currently selected work area. It is always best to use the 'In' clause with both of these commands.

    • Marked as answer by Liliane Teng Friday, July 16, 2010 7:24 AM
    Tuesday, July 13, 2010 1:28 AM