Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to rename a table of a database?
Message
From
17/12/2006 15:07:33
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01178413
Message ID:
01178421
Views:
18
First of all, make a backup first. The dbc is simply what's called metadata, data about data. If you change something in the dbc, the changes will not cause changes in other files. However, if you are not careful, you can easily break your queries or referential integrity settings.

>I have not thought about that, never tried to change anything in dbc directly. If I understand you correctly, after creating the TEMP table and dropping the Original table, I would change the Name reference in the .DBC. But that would not change the physical name of the table, right?
>
>Thank you.
>
>>Are you aware that you can simply Use the dbc, and change the relevant records?
>>
>>>I am having a tough time create a little routine to rename a table in a database. I want to add a TEMP table to a database of the same structure as one of the existing. Then drop the original table and rename the TEMP table into the original.
>>>
>>>Here is what I do:
>>>
>>>cTblName = "MyTable"
>>>use (cTblName)
>>>afields(aDbfStruct)
>>>set database to MyDatabase
>>>create table TEMP name TEMP from array aDbfStruct
>>>close tables
>>>drop table (cTblName)
>>>rename table ("TEMP") to (cTblName)
>>>*-- I was hoping that rename table will rename actual file name
>>>*-- but it does not. So I have to do this:
>>>rename ("TEMP.DBF") to (cTblName + ".DBF")
>>>rename ("TEMP.FPT") to (cTblName + ".FPT")
>>>
>>>
>>>But the table MyTable.DBF is not part of the database after all of that.
>>>
>>>What am I missing?
>>>
>>>Thank you.
Previous
Reply
Map
View

Click here to load this message in the networking platform