Alter Table woes

User avatar
garbsmj
4StarLounger
Posts: 453
Joined: 04 Feb 2010, 03:40

Alter Table woes

Post by garbsmj »

On the ever-so-cludgy MS developer site, it says you can do the following:

ALTER TABLE (Mickey)
ADD Minnie_Text Varchar(20) Null;

Works fine, but I'd like to add multiple fields and supposedly you can do:

ALTER TABLE (Mickey)
ADD ( Minnie_Text Varchar(20) Null,
Pluto_Text Varchar(20) Null);

However, the second one doesn't work. It either errors out at the first parens or it doesn't like the comma. Now I don't mind copy/pasting and running through the table multiple times because, well, it is a one-time event. I'm just wondering what could be wrong with the second statement. :scratch:
When one cat leaves, another mysteriously shows up.

User avatar
Jezza
5StarLounger
Posts: 847
Joined: 24 Jan 2010, 06:35
Location: A Magic Forest in Deepest, Darkest, Kent

Re: Alter Table woes

Post by Jezza »

Peggy

I used this syntax in Access2K3 and it worked fine

Code: Select all

ALTER TABLE Mickey
ADD  
Minnie_Text Varchar(20) Null,
Pluto_Text Varchar(20) Null;
Jerry
I’ll be more enthusiastic about encouraging thinking outside the box when there’s evidence of any thinking going on inside it

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

Re: Alter Table woes

Post by HansV »

Try it without the parentheses:

ALTER TABLE Mickey
ADD Minnie_Text Varchar(20) Null,
Pluto_Text Varchar(20) Null;

Oops - I was held up while replying. Jezza came up with the same SQL.
Best wishes,
Hans

User avatar
garbsmj
4StarLounger
Posts: 453
Joined: 04 Feb 2010, 03:40

Re: Alter Table woes

Post by garbsmj »

Oh...Okay. So my handy dandy sql book is wrong too.

Thanks Jerry and Hans! I don't know what I'd do without you guys. Well, probably :crybaby: a lot but you know....
When one cat leaves, another mysteriously shows up.

User avatar
Jezza
5StarLounger
Posts: 847
Joined: 24 Jan 2010, 06:35
Location: A Magic Forest in Deepest, Darkest, Kent

Re: Alter Table woes

Post by Jezza »

garbsmj wrote:Oh...Okay. So my handy dandy sql book is wrong too.

Thanks Jerry and Hans! I don't know what I'd do without you guys. Well, probably :crybaby: a lot but you know....
I have a feeling the author was probablya mySQL developer at some stage as the sintax is very similar
Jerry
I’ll be more enthusiastic about encouraging thinking outside the box when there’s evidence of any thinking going on inside it