Alter table syntax error

scottb
4StarLounger
Posts: 402
Joined: 14 Apr 2010, 15:59

Alter table syntax error

Post by scottb »

Hi everyone.
I am trying to run an alter table sql on an imported table to insert a field.
Access doesn't like the table name in the following and throws a syntax error:

Alter table Page 4- People
Add Column FacilityID Numeric

Is there a way to get this to work using the existing table name (bad as it is) ? There is an existing import and overwrite process that looks for that table name which would be a mess to rework.

Thank you for any help.
-Scott

User avatar
HansV
Administrator
Posts: 78457
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Alter table syntax error

Post by HansV »

If a table or field name contains spaces, punctuation etc., you must enclose it in square brackets.
And Numeric is not a valid data type in Access - use Long for whole numbers, or Double for numbers with decimals.
So, for example:

ALTER TABLE [Page 4- People] ADD COLUMN FacilityID LONG
Best wishes,
Hans

scottb
4StarLounger
Posts: 402
Joined: 14 Apr 2010, 15:59

Re: Alter table syntax error

Post by scottb »

Thank you Hans.

grovelli
4StarLounger
Posts: 528
Joined: 26 Jan 2010, 15:14

Re: Alter table syntax error

Post by grovelli »

Thanks for the heads-up and a Happy Easter :hello:

User avatar
HansV
Administrator
Posts: 78457
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Alter table syntax error

Post by HansV »

Buona Pasqua!
Best wishes,
Hans