Re: rename and rename table
- From: "Lew" <lew@xxxxxxxxxxx>
- Date: Fri, 4 Jul 2008 13:28:02 -0400
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?
.
- References:
- Re: rename and rename table
- From: Fred Taylor
- Re: rename and rename table
- From: Fred Taylor
- Re: rename and rename table
- From: Lew
- Re: rename and rename table
- From: Fred Taylor
- Re: rename and rename table
- Prev by Date: Re: rename and rename table
- Next by Date: ActiveX Control No Visible After Form INIT
- Previous by thread: Re: rename and rename table
- Next by thread: Re: rename and rename table
- Index(es):
Relevant Pages
|