Showing posts with label newbie. Show all posts
Showing posts with label newbie. Show all posts

Friday, March 23, 2012

Incorrect Syntax

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!

JakeJust 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]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OQBNC0cbEHA.3792@.TK2MSFTNGP09.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

Friday, February 24, 2012

Inadvertantly deleted detail row...

All,
I am a newbie and in working on an existing report, I inadvertantly
deleted the only detail row. I was able to get the report working, but
I had to use a group header as a detail row (fortunately I had a unique
value column), because I could not see how to add a detail row. MS is
very clear - whatever kind of row you are on when you choose to Insert
a Row Above or Below is the kind of row that will be created. Since I
did not have a detail row, I couldn't add one.
So, can you add a detail row when there isn't one? If so, how?
Any ideas, references, resources, war stories or good clean jokes on
the subject would be greatly appreciated.
Thanks,
KathrynClick on the table so that the handles appear. Right click the handle at the
end of the row on the table header row and then choose table details. Then
the row will reappear.
wrote:
> All,
> I am a newbie and in working on an existing report, I inadvertantly
> deleted the only detail row. I was able to get the report working, but
> I had to use a group header as a detail row (fortunately I had a unique
> value column), because I could not see how to add a detail row. MS is
> very clear - whatever kind of row you are on when you choose to Insert
> a Row Above or Below is the kind of row that will be created. Since I
> did not have a detail row, I couldn't add one.
> So, can you add a detail row when there isn't one? If so, how?
> Any ideas, references, resources, war stories or good clean jokes on
> the subject would be greatly appreciated.
> Thanks,
> Kathryn
>|||Kim,
Thanks so much! It's simple once you know it, but I couldn't find it
ANYWHERE online or in BOL.
Kathryn

Sunday, February 19, 2012

IN SQL Server Management Studio - Can connect to database sort of but Icon isn't green anymore

Preface: I'm a newbie at 2005 and sql server in general.

I can connect to a sql server (2005 express) but I can only make views and not run queries. When I open up a new query and create it with query designer and click add table I see no tables, views or anything in the box. When I create a new view in the database I do see tables and views though.

The little circle part of the icon on the server in the left hand pane is clear now when before it was green. I still can connect to the database ok but I can't use the query analyzer for queries anymore. I need to do that because I do have some slow running queries.

~Capt howdy

Select the database first (ie:AdventureWorks), 'new query' and then click design view.

|||I'm such a n00b with sql server it hurts sometimes. Thanks! I am used to access but it is definitely time to step up.

~Capt. Howdy

IN SQL Server Management Studio - Can connect to database sort of but Icon isn't green anym

Preface: I'm a newbie at 2005 and sql server in general.

I can connect to a sql server (2005 express) but I can only make views and not run queries. When I open up a new query and create it with query designer and click add table I see no tables, views or anything in the box. When I create a new view in the database I do see tables and views though.

The little circle part of the icon on the server in the left hand pane is clear now when before it was green. I still can connect to the database ok but I can't use the query analyzer for queries anymore. I need to do that because I do have some slow running queries.

~Capt howdy

Select the database first (ie:AdventureWorks), 'new query' and then click design view.

|||I'm such a n00b with sql server it hurts sometimes. Thanks! I am used to access but it is definitely time to step up.

~Capt. Howdy