I am transforming FoxPro code into SQL for a report. The current FoxPro Code is below. I need to be able to create two cursors, store data from two fields in them and check them against a table for replacing data. Can anyone help me transform this code into sql for sql server?
CREATE Cursor delete_cursor(salesno c(6), release_number c(3))
SELECT table1
GOTO TOP
lcsono= table1.salesno
lcrelease = table1.release_number
GOTO 2
SCAN REST
IF table1.salesno == lcsono AND table1.release_number <> "000"
AND lcrelease = "000"
SELECT delete_cursor
APPEND BLANK
REPLACE table1.salesno WITH lcsono
REPLACE table1.release_number WITH lcrelease
SELECT table1
ENDIF
lcsono = table1.salesno
lcrelease= table1.release_number
ENDSCAN
SELECT delete_cursor
INDEX on ALLTRIM(delete_cursor.salesno) + ALLTRIM(delete_cursor.releaseno)
TAG tagdelete
SELECT table1
GOTO TOP
SCAN
IF SEEK(ALLTRIM(table1.salesno) + ALLTRIM (table1.salesno),
"delete_cursor", "tagdelete")
REPLACE table1.delflag WITH "Y"
ENDIF
ENDSCAN
DECLARE CURSOR @fsono char(6)
update table1.salesno Set
table1.salesno = @fsono
where
@fsono = table1.salesno
AND table1.release_number <> "000"
AND lcrelease = "000"
DECLARE CURSOR @release char(6)
update table1.release_number Set
table1.release_number = @release
where
@fsono = table1.salesno
AND table1.release_number <> "000"
AND @release = "000"