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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INSERT vs INSERT - SQL

Tables

INSERT vs INSERT - SQL

by  ChrisRChamberlain  Posted    (Edited  )
The INSERT command was the native xBase language predecessor of the INSERT - SQL command and has one major advantage - it allows you to insert a new record anywhere in a table.

Modern processors largely overcome the performance problem associated with such a feature, but even so the use of the command needs careful consideration by the developer.

No longer documented but still available, the syntax of the [color blue]INSERT[/color] command is:-
[color blue]
INSERT [BEFORE] [BLANK]
[/color]
Description:
[color blue]
INSERT[/color] places a new record into the current table immediately after the current record and displays the new record for editing.

If [color blue]CARRY[/color] is [color blue]SET ON[/color] and [color blue]BLANK[/color] isn't included, data in the previous record is automatically copied into the new record.

Note - if the file is indexed, [color blue]INSERT[/color] works like [color blue]APPEND[/color].

Clause [color blue]BEFORE[/color]

[tab]Issuing [color blue]INSERT BEFORE[/color] inserts a new record into the current table immediately before the current record. The record is then displayed for editing. Data can only be entered into the new record.

Clause [color blue]BLANK[/color]

[tab]Issuing [color blue]INSERT BLANK[/color] inserts a new record into the current table immediately after the current record. An editing window is not displayed.

[tab]Issuing [color blue]INSERT BLANK BEFORE[/color] inserts a new record into the current table immediately before the current record. An editing window is not displayed.

Note - [color blue]INSERT[/color] is not recommended for use with large tables because an insertion near the front of the table forces the rewriting of nearly every record.

It' s also important to note that the [color blue]RECNO()[/color] order changes after each record insertion.

So if you [color blue]GO TOP[/color] and [color blue]INSERT BLANK BEFORE[/color], the [color blue]RECN()[/color] of that new record becomes 1, and what was previously 1 now becomes 2, etc.

ChrisRChamberlain
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top