Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Rename Columns with Access

Author  Topic 

SaKiM
Starting Member

4 Posts

Posted - 2001-12-13 : 02:56:48
Hello again,

I have problems with renaming columns,
with MySql it works with "Alter Table Tbl_Name Change col_old col_new varchar(30);" e.g.
But Access don't have this statement, so i'm searching for another way, e.g. to create a new column and copy the values from the old col in the new col, is there a sysntax for that like "Alter Table Tbl_Name Add Column col_neu as col_alt".
Has someone an idea?

thx
SaKiM

mono
Starting Member

36 Posts

Posted - 2001-12-13 : 06:13:55
Access 2000 does have DDL. It just isn't accessible through the GUI.

Check the DDL section of the Jet SQL reference in the Help pages Contents listing.

You can't change the name of a column in place as far as I can see, but adding a new column, copying the data and dropping the old one is straightforward.

I'd expect something like this to work:
ALTER TABLE Tbl_name ADD COLUMN col_new ....

UPDATE Tbl_name
set new_col = old_col

ALTER TABLE Tbl_name DROP COLUMN old_col


Go to Top of Page

SaKiM
Starting Member

4 Posts

Posted - 2001-12-13 : 07:07:03
Hi,

thx for your reply,
now it works fine.

SaKiM

Go to Top of Page
   

- Advertisement -