Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why isn't my ALTER clause?

Status
Not open for further replies.

programmher

Programmer
May 25, 2000
235
US
I get the below message upon execution of my ALTER clause:


ODBC Error Code = 37000 (Syntax error or access violation)


[MERANT][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'COLUMN'.


SQL = "ALTER TABLE tbl_States ADD COLUMN states counter PRIMARY KEY"

Data Source = "MyDatabase"

I am following the example as it appears on page 244 of the CF 4.5 book. Below is my code:

<cfquery name=&quot;addcolumn&quot; datasource=&quot;MyDatabase&quot;>

ALTER TABLE tbl_States

ADD COLUMN states VARCHAR(2)


</cfquery>

Can anyone shed some light?

 
The syntax for altering tables is not standard across databases. Try removing &quot;column&quot; so it reads

ALTER TABLE tbl_States
ADD states VARCHAR(2)

Hope this helps,
GJ
 
GJ,

I FINALLY figured that out and my query works great! Thanks for posting my answer. It's good to know I had an answer waiting for me!

P
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top