Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jun Tangunan
  Where is Jun Tangunan?
 Cabanatuan
 Philippines
 Jun Tangunan
 To: Cecil Champenois
  Where is Cecil Champenois?
 Little Elm
 Texas - United States
 Cecil Champenois
 Tags
Subject: RE: INSERT Command
Thread ID: 209752 Message ID: 209773 # Views: 2 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Wednesday, December 31, 2008 5:44:24 AM         
   


> >
> >
> > Yes, the old INSERT [BEFORE] command will still work, but I believe you need to have exclusive access to the table... I'm sure there are other restrictions as well (perhaps any table with a AutoInc field may prevent it as well... I haven't experimented with it).
> >
> > To be blunt, there really is no reason to insert a record between others... for appearance's sake, the table can instead be presented in some kind of indexed order so that things "look" logical.
> >
> > I'd recommend staying away from it.
> >
> > --Brad
>
> I feel the same way about that INSERT command. Better to have indexed tables/cursors.
>
> Cecil Champenois, Jr.

Like what Brad says, there is no point in doing that as we can sort/index the records in the table to make it appear "inserted" between target records, for reporting or viewing purposes. But if you really want to insert it between existing records (which I don't know why your client wants), you can do this:

a. Perform INSERT (which will insert it as the last record)
b. Create a sorted temp cursor
c. ZAP your previous table content && uh-oh!
d. Put the sorted record back to your table.

* Perform INSERT 
SELECT * FROM youroldtable ORDER BY yourfield INTO CURSOR junk 
SELECT YourOldTable
ZAP
APPEND FROM DBF("junk")  && Appending now the sorted data
USE IN SELECT("junk")
BROWSE NORMAL


NEVER TESTED NOR TRIED! LOL!

Jun Tangunan
http://weblogs.foxite.com/sandstorm36/

ENTIRE THREAD

INSERT Command Posted by Cecil Champenois @ 12/30/2008 8:42:32 PM
RE: INSERT Command Posted by Brad Schulz @ 12/30/2008 9:23:55 PM
RE: INSERT Command Posted by Cecil Champenois @ 12/30/2008 9:30:39 PM
RE: INSERT Command Posted by Mike Yearwood @ 12/31/2008 12:09:31 AM
RE: INSERT Command Posted by Jun Tangunan @ 12/31/2008 5:44:24 AM
RE: INSERT Command Posted by Anil Sharma @ 1/2/2009 8:01:15 AM
RE: INSERT Command Posted by Mike Yearwood @ 1/2/2009 4:30:51 PM
RE: INSERT Command Posted by Anil Sharma @ 1/3/2009 7:42:01 AM
RE: INSERT Command Posted by Cecil Champenois @ 1/3/2009 4:20:21 PM
RE: INSERT Command Posted by Anders Altberg @ 1/3/2009 8:26:09 PM
RE: INSERT Command Posted by Mike Yearwood @ 1/4/2009 4:23:23 AM
RE: INSERT Command Posted by Anders Altberg @ 1/2/2009 6:38:07 PM
RE: INSERT Command Posted by Pete Sass @ 1/2/2009 11:15:13 PM
RE: INSERT Command Posted by Samir Ibrahim @ 1/3/2009 2:47:33 PM
RE: INSERT Command Posted by Mike Yearwood @ 1/4/2009 4:24:56 AM
RE: INSERT Command Posted by Samir Ibrahim @ 1/5/2009 1:38:41 AM
RE: INSERT Command Posted by Mike Yearwood @ 1/5/2009 3:10:20 AM