If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Other PC Databases > delete a range of records

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-09-08, 22:51
wehrle wehrle is offline
Registered User
 
Join Date: Jul 2005
Posts: 99
delete a range of records

Is there a way to delete a range of records from a table by using the recno values?
Reply With Quote
  #2 (permalink)  
Old 03-10-08, 05:09
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,538
probably

you posted in the "Other PC Databases" forum, but neglected to mention which one you're using
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 03-10-08, 07:35
wehrle wehrle is offline
Registered User
 
Join Date: Jul 2005
Posts: 99
Visual FoxPro
Reply With Quote
  #4 (permalink)  
Old 03-10-08, 08:35
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
How would you normally go about deleting a record?
__________________
George
Twitter | Blog
Reply With Quote
  #5 (permalink)  
Old 03-10-08, 09:06
wehrle wehrle is offline
Registered User
 
Join Date: Jul 2005
Posts: 99
delete from sometable where somefield = somevalue

The problem is that I do not have any magic values to check in any normal fields. I only know a range of records by their record numbers.
Reply With Quote
  #6 (permalink)  
Old 03-10-08, 09:09
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Can you define what you mean by "record numbers" please?
__________________
George
Twitter | Blog
Reply With Quote
  #7 (permalink)  
Old 03-10-08, 09:15
wehrle wehrle is offline
Registered User
 
Join Date: Jul 2005
Posts: 99
The record number for record one is 1.
The record number for record two is 2.
I believe those numbers can be returned with the recno() function, but I am not sure.
Reply With Quote
  #8 (permalink)  
Old 03-10-08, 09:27
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Have you considered the GO command?
Code:
GO [RECORD] nRecordNumber [IN nWorkArea | IN cTableAlias]
However; you do realise that RecNo() should only be used when you specify the ORDER or the open table?

E.g.
Code:
USE people
SET ORDER TO surname
However, using FP code is not the best method for this. You are going to want to look at using SQL as per your example before.
Perhaps you want to delete records where the primary key value is between 20 and 30 inclusive
Code:
DELETE FROM people
WHERE   person_id BETWEEN 20 AND 30
__________________
George
Twitter | Blog
Reply With Quote
  #9 (permalink)  
Old 03-16-08, 18:41
Peto4122 Peto4122 is offline
Registered User
 
Join Date: Mar 2008
Posts: 4
Delete records

the dbase command is:- delete all for recno() > xx .and. recno() < xxx
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On