Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete certain fields from table
Message
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
00367412
Message ID:
00367440
Views:
19
Delete-SQL is the most efficient way to delete records from a table.

DELETE FROM MyFirstTable WHERE ItemName = SPACE(LEN(ItemName))

should do what you need.

A few notes:

1 - fields are columns in the table, you want to delete rows or records.
2 - If SET EXACT is OFF, MyFirstTable.ItemName = "" will always be .T.
3 - The code I wrote is most efficient (will use Rushmore optimization) if you have MyFirstTable indexed on ItemName
4 - You could test for EMPTY(ItemName), but you would need an index on EMPTY(ItemName) to take advantage of Rushmore optimization.

>Hello
>
>I am new to Visual FoxPro. I would like to delete fields from a table I am using. How would you go about deleting a field based off of certain criteria? I run this code in the init of my listbox when form first loads.
>
>*If name of field is not entered then delete this blank record
>If MyFirstTable.ItemName = "" then
> *Delete blank record
> DELETE
> *Skip to next record
> SKIP
> *Check to make sure we are on valid record
> IF EOF() THEN GO BOTTOM
>ENDIF
>
>Sometimes this code deletes what I would consider valid records. Is there anything else I could try to get this to work?
>
>Thank you
Brien R. Givens

Brampwood Systems
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform