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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alter Column results in Incorect syntax near 'Column' 1

Status
Not open for further replies.

skerr

Technical User
Joined
Aug 23, 2001
Messages
8
Location
US
I ran this query against the pubs database and it runs successfully

ALTER TABLE publishers ALTER COLUMN state CHAR(25)

I change the table & field names for my db as follows:
ALTER TABLE customquery ALTER COLUMN toclause CHAR(25)

and run against my database and I get the following error - Incorrect syntax near 'COLUMN'.

My column name is correct - I don't know why it would run fine against pubs, but not my db. I do not have quoted identifiers turned on. I have tried using [] around my column name [toclause], but that didn't change anything. Any help would be appreciated.
Thanks.
 

Check the compatibility level of the database. If it is 65 you can't alter a column. Use sp_dbcmptlevel to check.

Example: This will tell you the compatibility level.
sp_dbcmptlevel 'db_name'

Example: This converts to SQL 7 compatibility
sp_dbcmptlevel 'db_name',70

Use 80 if you are running SQL 2000 and want to convert to the latest level. Note that changing the compatibility level can break procedures and queries. Be cautiuous. Read about compatibility level in SQL BOL. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top