Re: Constraints

From: Ken Johnson <kjohnson_at_mo.net>
Date: 1996/05/27
Message-ID: <31AA43D1.4DDB_at_mo.net>#1/1


starlite_at_sun.cc.westga.edu wrote:
>
> I need to add a constraint to a table. I don't want to drop and recreate
> the table I just want to add a constraint.
>
> The syntax I am using is as follows:
> ALTER TABLE tablename ADD CONSTRAINT
> pk_xxxx PRIMARY KEY (column1, column2);
>
> I get the error message Invalid datatype on pk_xxxx. How do I
> creat a constraint on an existing table. Please reply to
> jeckles_at_westga.edu or jeanette_at_westga.edu.
>
> Thanks for any assistance.

I think you have the syntax slightly off try: ALTER TABLE tablename ADD
(
 CONSTRAINT pk_xxxx PRIMARY KEY (column1, column2) );

The only other problem I might see is if column1 or column2 is a LONG (or LONG RAW) field, which I don't believe can be used in a PRIMARY KEY.

Ken Johnson Received on Mon May 27 1996 - 00:00:00 CEST

Original text of this message