RENAME Column

  • Follow


Is there an Access SQL function to rename a column?

I tried the following:
ALTER TABLE tablename RENAME oldcolumn newcolumn;

ALTER TABLE tablename REN oldcolumn newcolumn;

ALTER TABLE tablename RN oldcolumn newcolumn;

all do not work.

Checked the Access SQL reference - found no reference to renaming
columns.
Any ideas?
0
Reply bubbles.one (43) 4/5/2010 3:56:57 AM

On Sun, 4 Apr 2010 20:56:57 -0700 (PDT), bubbles
<bubbles.one@hotmail.com> wrote:

Perhaps you can use three statements: one using the ADD COLUMN clause,
one using an UPDATE statement to copy the data over, and one using the
DROP COLUMN clause.

-Tom.
Microsoft Access MVP


>Is there an Access SQL function to rename a column?
>
>I tried the following:
>ALTER TABLE tablename RENAME oldcolumn newcolumn;
>
>ALTER TABLE tablename REN oldcolumn newcolumn;
>
>ALTER TABLE tablename RN oldcolumn newcolumn;
>
>all do not work.
>
>Checked the Access SQL reference - found no reference to renaming
>columns.
>Any ideas?
0
Reply Tom 4/5/2010 4:14:50 AM


Thank you, Tom. That was what I did.
I am surprised that this action is not supported in Access SQL.



On Apr 5, 12:14=A0pm, Tom van Stiphout <tom7744.no.s...@cox.net> wrote:
> On Sun, 4 Apr 2010 20:56:57 -0700 (PDT), bubbles
>
> <bubbles....@hotmail.com> wrote:
>
> Perhaps you can use three statements: one using the ADD COLUMN clause,
> one using an UPDATE statement to copy the data over, and one using the
> DROP COLUMN clause.
>
> -Tom.
> Microsoft Access MVP
>
> >Is there an Access SQL function to rename a column?
>
> >I tried the following:
> >ALTER TABLE tablename RENAME oldcolumn newcolumn;
>
> >ALTER TABLE tablename REN oldcolumn newcolumn;
>
> >ALTER TABLE tablename RN oldcolumn newcolumn;
>
> >all do not work.
>
> >Checked the Access SQL reference - found no reference to renaming
> >columns.
> >Any ideas?

0
Reply bubbles 4/7/2010 8:17:24 AM

On 7 Apr., 10:17, bubbles wrote:
> Thank you, Tom. That was what I did.
> I am surprised that this action is not supported in Access SQL.
Yes, MySql and Oracle can this, SQL-Server has sp_rename (
http://databases.aspfaq.com/database/how-do-i-rename-a-column.html ),
Access cannot.

Maybe they wonted to protect us against ourselves, as renaming a
column can break joins. But then it is easy to rename columns in VB.
Who knows?

Greetings
Marco P
0
Reply Marco 4/7/2010 11:34:28 AM

3 Replies
915 Views

(page loaded in 0.043 seconds)

Similiar Articles:













7/23/2012 7:01:46 AM


Reply: