Subject Re: DBase IV Commands
From Marilyn Price <marilyn@mpreflections.com>
Date Sat, 21 May 2016 10:55:30 -0600
Newsgroups dbase.getting-started

On 5/20/2016 1:24 PM, Ken Mayer wrote:

> First item:
> Do you need to do this as a command (in a program) or can you just use
> the table designer? In the table designer just change the field name.
>
> Otherwise it gets tricky, and you should back up the table first ...
>
> 1) Create a new field:
>
> alter table tablename add newfieldname type
>
> 2) replace contents of new field:
>
> use tablename
> replace all newfieldname with oldfieldname
> use
>
> 3) drop old field:
> alter table drop oldfieldname
>

Actually, Ken, it's a little more complicated than that, as dBase IV
didn't have any alter table commands.

In a program:
use oldtable
copy to temp sdf
copy structure to <some new name>
use <some new name>
locate for fieldname = "oldfieldname"
replace fieldname with "newfieldname"
append from temp sdf

Should do it. However, this is strictly from memory as I no longer have
dBase IV installed and haven't had for over a decade....

--
Marilyn Price
www.mpreflections.com