Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inserting Records in Between
Message
De
21/07/2013 08:22:56
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
21/07/2013 05:38:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01578969
Message ID:
01578972
Vues:
68
>If I have table say A and another table Say B and if I want to insert records of Table B in Table A, I may do it like this,
>
>
>Insert into A.DBF (Filed1) select Field1 from Table B.
>
>
>But how to insert the Table B records if I want to insert the Table B records after the record Number 10 i.e Recno() 10 of Table A.
>
>I.e How to insert Table B records in Table A after the Table A RECNO()>10

The approach is basically flawed. You should generally consider records in a table to be an unordered set; you achieve a specific order (1) through an index, or (2) in a SELECT - SQL command, with an ORDER BY clause. In both cases, you can use different orders at different times. You might order by a field that stores a date, and you may need to add some additional fields to achieve the desired ordering.

If you physically insert records in between other records, ALL the records after that have to be moved down; for a large table, this would be very inefficient. You might do it for a very small table, but even there, I don't really see the point.

You can indeed do it - check the INSERT command (not the INSERT INTO command, which is a separate command), but it is probably much better if you don't do it. Since this INSERT command inserts only one record at a time, you would have to write a loop to insert all the records you want.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform