Professional Web Applications Themes

FoxPro to SQL - Microsoft SQL / MS SQL Server

I have about 12 pages of FOXPRO codes to be written up in SQL. However, there is a SCAN command beginning in page 2 and ENDSCAN ends at page 12. The SCAN command in FOXPRO is for processing one record at a time. It will move to the next record when it reaches ENDSCAN. Within the SCAN- ENDSCAN, there are a lot 'IF-ELSE' clauses, DO CASEs and REPLACEs. What will be the best approach to deal with one record at a time similar to SCAN-ENDSCAN? Thank you in advance for your answer....

  1. #1

    Default FoxPro to SQL

    I have about 12 pages of FOXPRO codes to be written up in
    SQL. However, there is a SCAN command beginning in page 2
    and ENDSCAN ends at page 12. The SCAN command in FOXPRO is
    for processing one record at a time. It will move to the
    next record when it reaches ENDSCAN. Within the SCAN-
    ENDSCAN, there are a lot 'IF-ELSE' clauses, DO CASEs and
    REPLACEs.

    What will be the best approach to deal with one record at
    a time similar to SCAN-ENDSCAN?

    Thank you in advance for your answer.


    Jane Guest

  2. #2

    Default Re: FoxPro to SQL

    Jane,
    I am in the same boat, actually I was. We also had
    thousands and thousands of lines of procedural code to be
    converted to SQL 2K.
    What I have discovered is most of the time a select
    statement would achieve the same recursiveness as a scan-
    endscan or do-while's. Especially the Where part of the
    clause can be used extensively for any if-else-endif
    statements that mat exist inside do-loops or scan loops.
    Moreover case statement can be used within the select
    clause itself to determine any conditions for each row and
    for each column. In my experience so far I have seldom
    used a cursor for any of the stuff you are mentioning. As
    far as time is concerend it is negligible for any kind of
    updates or deletions as compared to do-while etc. kind of
    structures.

    Ricky

     
    CURSOR. 
    more details. 
    oriented approach which 
    as a single query. [/ref]
    in [/ref]
    2 [/ref]
    is [/ref]
    at 
    >
    >
    >.
    >[/ref]
    Ricky Guest

  3. #3

    Default Re: FoxPro to SQL

    To deal with one record at a time you will need to use a CURSOR.

    Look in BOL for 'DECLARE CURSOR' and 'Using Cursors' for more details.

    Be aware that operations using cursors are not efficient.
    In most cases, all the work can be done with a set oriented approach which
    is the recommended solution.
    You might find that all 12 pages of code could be written as a single query.

    HTH

    "Jane" <com> wrote in message
    news:04f701c3604e$3b1344e0$gbl... 


    Amy Guest

Similar Threads

  1. FoxPro vs. SQL
    By Alex in forum MySQL
    Replies: 12
    Last Post: November 18th, 12:24 PM
  2. Rushmore/Optimization between FoxPro and CF
    By Natesac in forum Coldfusion Database Access
    Replies: 3
    Last Post: April 7th, 09:25 PM
  3. searching lex & yacc for foxPro
    By mass in forum UNIX Programming
    Replies: 0
    Last Post: July 16th, 11:44 AM
  4. Trusted connection from FoxPro 5.0
    By Geoff Callaghan in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: June 30th, 07:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139