Re: rename and rename table

Tech-Archive recommends: Fix windows errors by optimizing your registry



I see what the difference is now. I did a RENAME TABLE with the DBC open,
which only renames the internal reference to the table, it doesn't actually
rename the physical file. That's more like opening the table with an alias.

It seems there's a different set of steps involved to physically rename the
file.

1) RENAME foo.dbf TO bob.dbf
2) OPEN DATABASE xxx EXCLUSIVE
3) RENAME TABLE foo TO bob
4) VALIDATE DATABASE RECOVER
and locate the new file (bob.dbf). Notice it now says "(Fixed") after
the "Cannot find file" message.


Or in your sample code: (names changed to protect the innocent <g>)

close data all
ERASE lewbob.*
create database lewtest
set DATABASE to lewtest
CREATE TABLE lewfoo (name c(10))
INSERT INTO lewfoo VALUES ("Bob")
USE IN lewfoo
RENAME TABLE lewfoo TO lewbob
RENAME lewfoo.dbf TO lewbob.dbf
? DBF()
? DBC()
VALIDATE DATABASE RECOVER

--
Fred
Microsoft Visual FoxPro MVP


"Lew" <lew@xxxxxxxxxxx> wrote in message
news:ua0UO1e3IHA.3384@xxxxxxxxxxxxxxxxxxxxxxx
Sorry, I still can't make it work. Run the following in vfp9/sp2

close data all
ERASE bob.*
create database test
set DATABASE to test
CREATE TABLE foo (name c(10))
INSERT INTO foo VALUES ("Bob")
USE IN foo
RENAME foo.dbf TO bob.dbf
? DBF()
? DBC()
VALIDATE DATABASE && << will look for & won't find foo

"Fred Taylor" <ftaylor@xxxxxxxx!REMOVE> wrote in message
news:%23GD4HFX3IHA.4284@xxxxxxxxxxxxxxxxxxxxxxx
What version of VFP? Works OK in VFP/SP2. I couldn't try it in VFP6,
I've got things in the DBC that 6 doesn't deal with.

Sounds like you may have renamed it without the DBC being opened.

--
Fred
Microsoft Visual FoxPro MVP


"Lew" <Lew@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:AEEF91F3-2F5C-4EEE-8958-4493C82876C8@xxxxxxxxxxxxxxxx
... guess not. validate database reports that the table (by its original
name) is not found. Project manager isn't updated either.

"Fred Taylor" wrote:

If the DBC is open (OPEN DATABASE yourdbc) and current, the RENAME
command
should work fine.

--
Fred
Microsoft Visual FoxPro MVP


"Lew" <Lew@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:EB0EDE07-0EF6-40A4-8D15-FFB18ED40705@xxxxxxxxxxxxxxxx
How can I rename tables in a dbc so that the disk name and the
dbcname are
updated and the backlink unbroken?









.



Relevant Pages

  • Re: rename and rename table
    ... It seems there's a different set of steps involved to physically rename ... OPEN DATABASE xxx EXCLUSIVE ... INSERT INTO lewfoo VALUES ... DBC() ...
    (microsoft.public.fox.programmer.exchange)
  • RENAME TABLE in DBC und auf der Festplatte
    ... RENAME TABLE Table1 TO Table2 benennt mir zwar im DBC die Tabelle um, auf der Festplatte ist es aber weiterhin der alte name Table1.dbf ...
    (microsoft.public.de.fox)
  • Re: How to rename connection?
    ... Run GenDBC.prg on your DBC. ... >I want to rename a connection in the dbc. ... > but what happen to the connection name in each remote view. ...
    (microsoft.public.fox.vfp.dbc)
  • Re: Rename Free Table via VFP6 ODBC
    ... it's not stored in a dbc or anywhere else. ... use the command you would use to rename any ... other file to rename the dbf file, ...
    (microsoft.public.fox.programmer.exchange)
  • Re: RENAME TABLE in DBC und auf der Festplatte
    ... den neuen DBC auszuliefern und beim Kunden einfach vor dem DBC-Copy ein RENAME der beiden Dateien durchzuführen. ...
    (microsoft.public.de.fox)