Re: rename and rename table



I'm trying to automate this and avoid the locate dialog. It's beginning to
look like copy to xxx database zzz with production & drop table will be
simpler.

"Fred Taylor" <ftaylor@xxxxxxxx!REMOVE> wrote in message
news:u8OdJhf3IHA.4988@xxxxxxxxxxxxxxxxxxxxxxx
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: Change Field Name in Table
    ... try to figure out the delete and/or renaming it again. ... table with the make Table query or even using the DoCmd Copy. ... move everything over to another database and use the new database. ... was Imported and you should be able to rename it. ...
    (microsoft.public.access.formscoding)
  • Re: rename and rename table
    ... I did a RENAME TABLE with the DBC open, ... OPEN DATABASE xxx EXCLUSIVE ... INSERT INTO lewfoo VALUES ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Security Wizard
    ... you can't just rename/delete all existing mdw files. ... If you found system.mdw and renamed it, just rename it back to system.mdw and try and open Access. ... Accounts and Encrypt/Decrypt the database. ... Security Wizard at this time': ...
    (microsoft.public.access.gettingstarted)
  • Re: ESENT Event ID 474 Database page cache error
    ... As your server is freezing this usually means hardware so check all your ... Resetting the FRS database with the following steps: ... Rename the ntfrs.jdb file in the \ntfrs\jet folder. ...
    (microsoft.public.windows.server.sbs)
  • Re: Cant Rename Form in AC 2007
    ... I was able to rename it after I rebooted. ... Look at the Has Module property ) If it is No, this suggestion won't help. ... Make a backup copy of your database, ... In the code window, Select all from this window Open a copy of notepad, paste the code in, and save it as a text file. ...
    (microsoft.public.access.forms)