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!

delete from a table records with some characters not needed 2

Status
Not open for further replies.
Jan 20, 2007
237
US
Hi,
I have a table with two fields
field1 =mydbf C(40)
field2 = tick L

So i have these values in the table
Code:
MYDBF                  TICK
100013.DBF              F
100013A.DBF             F
100174.DBF              F
100174A.DBF             F

I want get rid of the records with the letter "A"
thanks in advance
 
No problem Scott

Nice readable code, I don't think I have ever used OCCURS() before, something new every day.



Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Delete For Between(Asc(Right(Juststem(mydbf),1)),65,122) can be replaced by this:

Delete For IsAlpha(Right(Juststem(mydbf),1))
 
Delete For Between(Asc(Right(Juststem(mydbf),1)),65,122)

Well, that will delete records that contain any capital letter - not just "A".

If that's what you want, fine. But it is different from what you originally asked for. And different from what you asked for later in the thread.

Also, [tt]BETWEEN(ASC(..., 65, 122))[/tt] is unnecessary. You can simply test for [tt]ISALPHA(...)[/tt].


mIKE


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Tore,
Yeah, I get that it's more lines. But it works in all versions of Fox back to FoxBase Plus... so has the advantage of backward compatibility.
I'm a big fan of reducing the lines of code down to small numbers where it's still readable, or where speed is critical. Your solution is elegant, but requires a deeper knowledge of the language. I still like it though. landfla seems to be a novice to Fox (no offence landfla), so I went with an approach that I thought was more digestible to a novice.

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Notice, Scott, that DELETE here also is a legacy dbase command and not SQL-DELETE, it uses the FOR clause and not a WHERE clause. So Griffs simple DELETE FOR also is legacy code a VFP novice knowing legacy Foxpro 2.6 has to know, albeit much simpler than a loop. The only "expert" knowlegde is about the $ operator. But it's not hard to look that up.

Bye, Olaf.
 
Ok, point taken.

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top