Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename name fiels of .mdb tables

Status
Not open for further replies.

tsetse

Programmer
Sep 7, 2001
10
BE


hi,

I would like to rename, IN RUN-TIME, then name of a field X in a table Y (in MDB file).

It doesn't seem to be possible via SQL statment like ALTER TABLE ?

Perhaps via API ????

Thanks a lot,

Bye

Jeff
 
Jeff, I am not sure this is possible. But a better question is WHY? You would also need to have the code to go through and change the name of the field in all queries, forms, etc. Not a good idea. Sounds more like an initial design problem.

Let us know what you are really trying to do and maybe we can help you out... Terry M. Hoey
 
Well, it is possible. (Create a new column z, move data to new column, delete column x), but I agree with Terry. Why do you need to rename a field??????

I absolutely despise having to rename a field while I'm designing a database, because of the hassle of finding all references to the field and renaming those. Changing a field name at runtime would be unthinkable!

If you want the field to have a different name on forms and reports then you can always use an alias in a query instead of re-naming. Maq B-)
<insert witty signature here>
 
I get the feeling this is one of those &quot;I built a DB for Bob, and now Mary wants to use it too, so I have to rename it&quot;. TseTse, I don't mean that to sound mean. I have seen lots of people do it. But it does nothing but make it more difficult later,

Like I said, give us an idea of what your goal is and I am sure we can help you get there... Terry M. Hoey
 

Hi, th3856 and maquis,

First, thank you for your fast reponses.

Here is my problem:
A month ago I had 2 systems: one AS400 system and one NT-based system. Both were COMPLETELY INDEPENDANT.

Sure, a lot of applications are based on the file 'ARTICLES' with a field named 'NART' (the ID product).
And on NT i have also a lot of MDB-applications based also on a table 'Articles' but with the field 'Réf Article' as ID product (also a key field). 'NART' and 'Réf article' are and must be exactly the same for the coherence of the files.

Today I have an interface application between both systems. With it I can 'export' my AS400 file in a MDB-table but the AS400 fields names are conserved. And here was my question. How can i rename the name 'NART' to 'Réf article' ?. The solution proposed by MAQUIS is good (creating a new field, copying to this new field and deleting the old field) but there were a lot of I/O operations want i have 89 (and not 1) fields to rename ! and 10000 products.

Thanks for your help

Sorry for my english, I do my best
regards from Belgium

jeff
 
I would think that you should import the data from your other DB, create a table on your MDB side that has all the table names as you want them to be, and then write a query that pulls the data from your linked table to your &quot;properly named&quot; table. Terry M. Hoey
 
Jeff, you can create a query based on your table and rename the fields in the query. The actual field names do not change, but any application which references the query will see the &quot;alias&quot; in the query and not the real field name. You could then use this query to export the data to another application.

For importing data into a table with different field names you can either use an import spec to drop the fields where you need them, or import the file to a temporary staging table and then use queries to move the data into your real table.

This sounds like a much simpler solution to your problem than restructuring the table.

Maq B-)
<insert witty signature here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top