Phil,
In order to drop a PRIMARY KEY or any key for that matter you
need to know the "NAME" assigned by RBase. Do the following at
an R> LIST PKEY FOR blockcodes
The first column is the name assigned by RBase
If this column is referenced by other foreign keys you will need
to drop the FOREIGN KEYS first.
Correct syntax is
ALTER TABLE blockcodes DROP CONSTRAINT constraintname
Where constraintname is the one found above
Jim Bentley
--- Bernard Lis <[EMAIL PROTECTED]> wrote:
> Hi Phil,
> since optcode exists in other tables, you will have to rename
> it in those tables first
> then
> You could create another column OptcodeTxt text 6
> then
> update BlockCodes set OptCodeTxt = (ctxt(OptCode))
> then
> alter table BlockCodes drop col OptCode
> then
> ren col OptcodeTxt to OptCode in BlockCode
>
> Have fun,
> Bernie Lis
> ----- Original Message -----
> From: [EMAIL PROTECTED]
> To: RBASE-L Mailing List
> Sent: Thursday, April 24, 2008 10:26 PM
> Subject: [RBASE-L] - Alter table in 6.5++
>
>
> We are currently on Rbase 6.5++. I defined a table and its
> primary key with the following commands:
> CREATE TABLE blockcodes +
> (cptcode INTEGER NOT NULL,+
> blockcatcode INTEGER,+
> epidural TEXT (1) DEFAULT 'N' NOT NULL)
> ALTER TABLE blockcodes ADD PRIMARY KEY (cptcode) +
> ('cptcode already on file.', +
> 'Cannot delete--value exists in another table.', +
> 'Cannot update--value exists in another table.')
>
> I now need to redefine cptcode to a text field. I tried the
> following: ALTER TABLE blockcodes ALTER cptcode TO cptcodet
> TEXT (6). Rbase gave me the following error: -ERROR- Column
> cptcode is indexed and may not be altered. (1143). Cptcode is
> the primary key of the blockcodes table so I tried to removed
> it with the following: ALTER TABLE blockcodes DROP CONSTRAINT
> PRIMARY KEY (cptcode). This gave me the error: -ERROR-
> Invalid constraint identifier. (2743).
>
> Can someone advise how I can redefine the cptcode column as
> text or how to remove the primary key from the table?
>
> Thanks a bunch,
> Phillip Cecil
Jim Bentley
American Celiac Society
[EMAIL PROTECTED]
tel: 1-504-737-3293
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ