A correction to syntax below it should be:
Alter Table Customer ALTER COLUMN CustNub2 to NOT NULL Primary Key 
Jim Bentley
American Celiac Society
[EMAIL PROTECTED]
tel: 1-504-737-3293



----- Original Message ----
From: James Bentley <[EMAIL PROTECTED]>
To: RBASE-L Mailing List <[email protected]>
Sent: Thursday, November 20, 2008 1:48:54 PM
Subject: [RBASE-L] - RE: Command for setting Primary and Forign keys intable

Steve,

If you use a utility option to set the primary key attributes it automatically 
includes the syntax to define the column as NOT NULL.

To do so at the command line you would code:
Alter Table Customer Add COLUMN CustNub2 NOT NULL Primary Key 

Jim Bentley
American Celiac Society
[EMAIL PROTECTED]
tel: 1-504-737-3293



----- Original Message ----
From: Steve Breen <[EMAIL PROTECTED]>
To: RBASE-L Mailing List <[email protected]>
Sent: Thursday, November 20, 2008 1:05:38 PM
Subject: [RBASE-L] - RE: Command for setting Primary and Forign keys intable

Larry,

I am confused here. I am using the 6.5++ utilites and it will allow me
to set a primary key on custnub2 which is a text column but when I try
to do it from a R: prompt it will not let me.



Gives me errors like it all ready has a index.

Then after dropping Index

I get

-ERROR- As column CUSTNUB2 is used in another table, its type cannot be
redefined

Not sure which way to go?

Steve





-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Lawrence
Lustig
Sent: Thursday, November 20, 2008 1:41 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: Command for setting Primary and Forign keys
intable

<<
Any Idea why I get this error
R>Alter Table Customer Add Primary Key (CustNub2)
-ERROR- Column CUSTNUB2 must be declared explicitly NOT NULL. (2722)
>>


For exactly the reason stated in the error message.  Any column that
participates in a primary key must be explicitly NOT NULL as part of its
declaration.

ALTER TABLE Customer ALTER COLUMN CustNub2 **INTEGER** NOT NULL

(I'm assuming your field in integer -- you might have another datatype).

This alter will fail if there are any NULL values in Customer.CustNub2.
--
Larry


      


Reply via email to