SQL syntax help

  • Thread starter Thread starter Brad Markisohn
  • Start date Start date
B

Brad Markisohn

I'm programmatically adding a column to a table in an existing Access DB.
I'm having a problem with table and field names that are strings composed of
more than one word. This command works just fine:

"ALTER TABLE Test ADD COLUMN ID varbinary"

but this doesn't work and gives an Alter Table syntax failure:

"ALTER TABLE 'Test Step' ADD COLUMN 'ID Type' varbinary"

It seems that it doesn't like the quote marks. Any suggestions?

Thanks

Brad
 
I figured this out. A very novice SQL mistake. The correct format
should've been:
"ALTER TABLE [Test Step] ADD COLUMN [ID Type] varbinary"
 
Do yourself (and the person that inherits your code) a favor. Stop using
imbedded spaces in object names.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Brad Markisohn said:
I figured this out. A very novice SQL mistake. The correct format
should've been:
"ALTER TABLE [Test Step] ADD COLUMN [ID Type] varbinary"


Brad Markisohn said:
I'm programmatically adding a column to a table in an existing Access DB.
I'm having a problem with table and field names that are strings composed of
more than one word. This command works just fine:

"ALTER TABLE Test ADD COLUMN ID varbinary"

but this doesn't work and gives an Alter Table syntax failure:

"ALTER TABLE 'Test Step' ADD COLUMN 'ID Type' varbinary"

It seems that it doesn't like the quote marks. Any suggestions?

Thanks

Brad
 
Back
Top