Ron,
I assume that you want to physically insert a field into an existing table, otherwise you would use ALTER TABLE, right?
There are different ways of doing this. They are more or less painful depending on your situation. Here are two ways I can think of:
*-- create new table structure
*-- append from existing table
*-- rename old table
*-- rename new table to original table
*-- delete old table if successful
*-- SELECT Field1, SPACE(10) AS NewField, FieldN FROM OriTable INTO TempTable
*-- rename old table
*-- rename new table to original table
*-- delete old table if successful
This works relatively well if you're dealing with a free table that doesn't have any indexes. If you have index tags, you need to save the tags in order to recreate them correctly on the new table. If your table is part of a DBC and contains relations, triggers, etc. this may get very tricky. In this case you may want to checkout SDT.
Maybe you could tell us why you need to have the fields in a specific order. Is it for an APPEND FROM? There may be other solutions the particular problem.
HTH
>Hello,
>
>Is there a way to insert a field into an existing table? I do not mean appending a field with: "ALTER TABLE xx ADD COLUMN yy"
>
>With "MODIFY STRUCTURE" you do can insert a field, but I need to do it with code, could anybody please help me out?
>
>Thanx in advance
>Ron
Daniel