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 5 5613
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
--
> 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.
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.)
> /* ARTICLES */ alter table ARTICLES add column CONTENTTYPE_REF int null go
I got the statements straight out of the Microsoft book "Inside Microsoft SQL Server 2000"
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.)
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
"Aaron [SQL Server MVP]" <te*****@dnartr eb.noraa> wrote in message
news:OQ******** ******@TK2MSFTN GP09.phx.gbl... /* ARTICLES */ alter table ARTICLES add column CONTENTTYPE_REF int null go
I got the statements straight out of the Microsoft book "Inside
Microsoft SQL Server 2000"
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.)
> My guess is that Jake pulled the ALTER TABLE ALTER COLUMN syntax out of
the book, and then changed ALTER COLUMN to ADD COLUMN.
That was my guess too, but wanted to prod a bit more; maybe he found
something the rest of us missed. ;-)
A This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jeff Magouirk |
last post by:
Dear Group,
I am trying to create a view and keep getting the Incorrect syntax near the
keyword 'Declare'" error.
Here is the code I am writing.
Create view fixed_airs (sid, fad_a2, fad_a3) as
Declare @sid int,
@fad_a2 int,
|
by: teddysnips |
last post by:
In the script below is the DDL to create some tables and a UDF.
What I'm interested in is the UDF at the end. Specifically, these few
lines:
--CLOSE OTRate
--DEALLOCATE OTRate
ELSE -- @NumRecords <= 0
If I uncommment CLOSE and DEALLOCATE and check the syntax I get a
|
by: Carl |
last post by:
Can you tell me what is wrong with this syntax ?
string select = "UPDATE .. " +
"(,,,,,,,
,,,,
,,, ,
, , ) " +
" VALUES
(@id,@clientid,@total,@tps,@tvq,@gtotal,@datefac,@datepay,
|
by: ypjofficial |
last post by:
HI,
I have following terrific confusion.
class test
{
public:
int i;
int * j;
int **k;
|
by: Sandesh |
last post by:
Hello All,
Me saying " has any body come across such error would be
underestimating".
Well I am getting a very peculiar and unique error "Line 1: Incorrect
syntax near 'Actions'."
Explaining you the scene is the following Stored Proc.
| |
by: iporter |
last post by:
In the following code, the two Response.Write statements output exactly
the same - I can copy and paste both into Query Analyzer, and run them
fine. However, if I comment out line 3, the assignment of "SELECT
T..." to the variable query, the last line produces the error:
Line 1: Incorrect syntax near '<'.
Many thanks in advance for any explanation - the problem is tearing my
hair out!!
Iain
|
by: wallic |
last post by:
Hello,
This is my first post and I am a beginner with SQL code. The code below is supposed to update a new table (loctable) with a calculated value based on the original table (hra_data). There are 3 possibilities in the hra_data table that will cause the loctable to be updated with the calculated value. After playing with it, I thought it was in the correct format but I keep getting an "Incorrect syntax..." error. Any guidence would be...
|
by: roamnet |
last post by:
hi
i created database file with .mdf extention ,sql server as a source
and use grid view to display data
there're no problem in data retrieve and display,but i want to edit it
or insert new records
there is an error "Incorrect syntax near '-'.
Must declare the scalar variable "@UserName".
I worked out in design view,code is automatically generated.Iam not
able fix the error.
Iam working with Visual Web Developer-2005 Express Edition
|
by: arial |
last post by:
Hi,
I am getting this error message:
Incorrect syntax near the keyword 'where'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'where'.
Source Error:
|
by: karenkksh |
last post by:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'user'.
Source Error:
Line 35: MyAdapter1 = new SqlDataAdapter(MyCommand1);
Line 36: MyDataSet1 = new DataSet();
Line 37: ...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |