Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

message 7325 - Nulls not allowed in a primary key column

205 views
Skip to first unread message

Bret Halford

unread,
Mar 4, 1998, 3:00:00 AM3/4/98
to

Maxine G. wrote:
>
> I'm moving a database from a Sybase 10 system to a Sybase 11 system. I'm just
> at the point of running my create table scripts and ran into a snag. I got
> error message "7325 - Nulls not allowed in a primary key column" for one of my
> tables. There is one primary key defined. The column referenced by that key is
> defined as "int NOT NULL". I can't figure out why I'm getting this message.
> Any advice would be appreciated.
> If it will help, here's the entire create table statement:
>
> CREATE TABLE PROFILE
> (ucbid int NOT NULL,
> ucoid int NULL,
> stuid char(8) NULL,
> empid char(9) NULL,
> searchlname varchar(50) NOT NULL,
> searchfname varchar(25) NOT NULL,
> searchmname varchar(25) NULL,
> kerbname varchar(40) NOT NULL,
> realm varchar(255) NOT NULL,
> emailacct varchar(255) NULL,
> emailsys varchar(255) NULL,
> proexpdate smalldatetime NOT NULL,
> promoddate smalldatetime NULL,
> conflag int NULL,
> facflag int NULL,
> emailrelflag int NULL,
> ucosearchid varchar(10) NOT NULL,
> promodsrc varchar(10) NOT NULL,
> proexpsrc varchar(10) NOT NULL,
> validflag int NULL,
> acsenflag int NULL
> PRIMARY KEY (ucbid)
> )
>

Well, this is a pretty subtle syntax error. And I'm not sure yet
if it is on the part of the user or the server :-)

Without a comma following the definition of acsenflag, the
server is trying to apply the "primary key" constraint to the
acsenflag column (the parser never even gets to the "(ucbid)" part.


Consider the difference between these two statements:

create table foo (x int not null, y int not null primary key)

create table foo (x int not null, y int not null, primary key (x))

--
Bret Halford Imagine my disappointment
Sybase Technical Support in learning the true nature
3665 Discovery Drive of rec.humor.oracle...
Boulder, CO 80303

Maxine G.

unread,
Mar 5, 1998, 3:00:00 AM3/5/98
to


*********************************************************
return address changed to prevent spamming
Remove "NOSPAM" in the return address
Maxine Gerber
PCG Systems
*********************************************************

Maxine G.

unread,
Mar 5, 1998, 3:00:00 AM3/5/98
to

In article <34FE0A...@sybase.com>, Bret Halford <br...@sybase.com> wrote:
>Well, this is a pretty subtle syntax error. And I'm not sure yet
>if it is on the part of the user or the server :-)
>
>Without a comma following the definition of acsenflag, the
>server is trying to apply the "primary key" constraint to the
>acsenflag column (the parser never even gets to the "(ucbid)" part.
>
>
>Consider the difference between these two statements:
>
>create table foo (x int not null, y int not null primary key)
>
>create table foo (x int not null, y int not null, primary key (x))

Oh, you're good! I don't know if I ever would have spotted that. I've been
programming for about a million years, and it's always the little things that
stump me. Thank heavens for the internet - I could have wasted a lot of time
on that one.
Thanks!
-Maxine

Matthew O. Persico

unread,
Mar 5, 1998, 3:00:00 AM3/5/98
to

So why can't Sybase print:

"7325 - Nulls not allowed in a primary key column ascenflag"

They do this all over the place. Error messages without context. If you
know that column#13 had a bad BCP insert, give me the damn column name
so that at two o'colok in the morning I don't have to count lines on an
sp_help output!

Anthony Mandic

unread,
Mar 6, 1998, 3:00:00 AM3/6/98
to

Yeah, I agree. Its a real nuisance. So join ISUG and start campaigning
for enhancements like this (only to see "NO PLANS" as the reply
while they concentrate on useless marketing gimmicks!).

-am

0 new messages