all groups > sql server misc > july 2004 >
You're in the

sql server misc

group:

Incorrect Syntax


Re: Incorrect Syntax Kalen Delaney
7/19/2004 1:41:57 PM
sql server misc:
I'd be interested to see that also. :-)

Not that there are absolutely no mistakes in the book, but I just did a
search of the electronic version of the book, and did not find this error.
In fact, I found this note, basically warning about the word 'column' not
being used when adding a new column:


NOTE

----------------------------------------------------------------------------
----

Notice the syntax difference between dropping a column and adding a new
column: the word COLUMN is required when dropping a column, but not when
adding a new column to a table.



My guess is that Jake pulled the ALTER TABLE ALTER COLUMN syntax out of the
book, and then changed ALTER COLUMN to ADD COLUMN.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


[quoted text, click to view]

Incorrect Syntax GitarJake
7/19/2004 3:27:42 PM
Hello all,

Newbie here.
SQL 2000, Windows 2000

I'm trying to alter tables in my SQL DB using statements like the following:

/* AD_GROUPS */
alter table AD_GROUPS alter column AD_GROUP_NAME nvarchar(64)not null
go

/* ARTICLES */
alter table ARTICLES add column CONTENTTYPE_REF int null
go

I get error messages like:

Server: Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'column'

I got the statements straight out of the Microsoft book "Inside Microsoft
SQL Server 2000"

Thanks in advance for helping to train this raw recruit!

Jake


Re: Incorrect Syntax Aaron [SQL Server MVP]
7/19/2004 4:07:58 PM
[quoted text, click to view]

And pardon the pun, but this missing part of the syntax won't be added
anytime soon, either. ;-)

--
http://www.aspfaq.com/
(Reverse address to reply.)

Re: Incorrect Syntax Aaron [SQL Server MVP]
7/19/2004 4:14:12 PM
[quoted text, click to view]

What page? I'd be interested to see a line like that, with the incorrect
column keyword where it is in your statement.

--
http://www.aspfaq.com/
(Reverse address to reply.)

Re: Incorrect Syntax Aaron [SQL Server MVP]
7/19/2004 4:48:37 PM
[quoted text, click to view]

That was my guess too, but wanted to prod a bit more; maybe he found
something the rest of us missed. ;-)

A

Re: Incorrect Syntax David Portas
7/19/2004 8:33:48 PM
Just grop the "COLUMN" keyword from the ADD statement:

ALTER TABLE Articles ADD contenttype_ref INT NULL

Your ALTER COLUMN statement is correct. It's just a peculiarity of the
syntax that the word "COLUMN" isn't required after ADD.

--
David Portas
SQL Server MVP
--

AddThis Social Bookmark Button