Alter table rename column (1 Viewer)

RobMc

New member
Local time
Today, 07:07
Joined
Jul 25, 2005
Messages
8
Hopefully someone can help....

I'm trying to change the name of a column in a table using SQL. I've tried different combinations but always get

"Syntax error in Alter Table statement"

SQL I've tried

alter table tblImport
rename column F1 to [Date];*

alter tblImport
rename column F1 to [Date];

alter table tblImport
rename F1 to [Date];

I've checked this out via some SQL sites & think the first version (*) is correct....can someone throw light on this? I'm using Access2000
 

RuralGuy

AWF VIP
Local time
Today, 01:07
Joined
Jul 2, 2005
Messages
13,826
I don't know about the SQL yet but naming a field to an Access reserved word is a real lousy idea.

Added:
I can not find Rename in the SQL BOL under ALTER TABLE. I see add and drop but no rename.
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:07
Joined
Feb 19, 2002
Messages
42,981
I don't see RENAME as an option when I look at the ALTER syntax. Looks like you'll need to add a new column, copy the data, then delete the original column.
 

RobMc

New member
Local time
Today, 07:07
Joined
Jul 25, 2005
Messages
8
Thanks

Many thanks for trying to help. I've gone via the 'create a new one, delete the old' route!
 

Users who are viewing this thread

Top Bottom