Kadrin


Hello,

I am working on a project where I need to put parts of a table into another table using a SELECT statement. Later in my project I use that table and have to use the Index as well but when I insert the selected information into the new table my index is erased from the table. Is there a way to solve this



Re: Select Statement INTO table removes table INDEX

Naomi Nosonovsky


Hi Kadrin,

If you want to get an answer, you can either post some code or give a better desciption of a problem. Are you using structural or non-structural indexes






Re: Select Statement INTO table removes table INDEX

Kadrin

SELECT * ;
FROM tbl1 ;
WHERE fld1 = {01/01/2001} INTO table tbl2

Later in the program:

IF SEEK(lcfld3, "tbl2", "xfld3")
= CalculateTotal(.f., lcTotFiltCurr)

Basically the Index is wiped out every time I insert new data to tbl2.





Re: Select Statement INTO table removes table INDEX

Tamar E. Granor

That's because the way you're doing it, you're totally replacing that table each time you run the query. If that's not what you mean to do, take another approach. If this is VFP 8 or later and you want to add these records to an existing table, use:

INSERT INTO Tbl2 ;
SELECT * ;
FROM tbl1 ;
WHERE fld1 = {01/01/2001}

Otherwise, select into a cursor and then APPEND FROM the cursor into the table.

Tamar




Re: Select Statement INTO table removes table INDEX

Kadrin

Alright, sadly I have to use VFP5 but the second 1 you suggested should work thank you.