Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cursor indexes 3

Status
Not open for further replies.

redzombi19

Programmer
Jun 2, 2002
35
US
ok this my be a bit of an ignorant question but how do you create an index with the cursor?
thanks!
 

select * from myTable into cursor myCursor
INDEX on custnum tag custnum

Note cursor can only have one index.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
It's not a stupid question.

INDEX on myField TO myIndex

Should create an independent idx file named myIndex.idx

Since the cursor is a VFP temp file and the idx is not, you must delete the idx file when you are done:

DELETE FILE myIndex.idx

Jim Osieczonek
Delta Business Group, LLC
 
Mike, you must have submitted just before I did.

One note on your post though - the cursor can only have one index per idx file, but you can open the table with several indexes. Kind of like the way we had to do it in Dbase III+

Jim Osieczonek
Delta Business Group, LLC
 
thanks, Mike & Jim

that did just what i needed (i knew it would be something simple like that!)
but now i cant find whare the index file is to delete it, is it in the default directory, or what?

thanks again!


 
redzombi19,

There is no need to delete the IDX file, since you created it on a temporary cursor VFP handles the deleting of the IDX for you. You are correct however, the idx file is created in the default directory unless you specify otherwise.

Slighthaze = NULL
[sub]craig1442@mchsi.com[/sub][sup]
"Whom computers would destroy, they must first drive mad." - Anon​
[/sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top