ALTER TABLE ALTER COLUMN colname datatype

You simply redefine the column without the NOT NULL syntax.

Dennis McGrath

________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of Emmitt Dove
Sent: Thursday, August 06, 2009 12:14 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Programmatically dropping a NOT NULL constraint

I am programming some structure changes that I want to run from a command file. 
 I have a table with a NOT NULL constraint that I need to drop.  The column 
also has a PK.

I've figured out how to drop the PK, but the NOT NULL is stumping me.

In SYS_CONSTRAINTS the SYS_CONSTRAINT_ID is -784 for the column (an integer 
value).

When I do this:

ALTER TABLE slsterms DROP CONSTRAINT -784

I get an error message that reads:

-ERROR- Invalid constraint identifier. (2743)

Now, for the PK, which was SYS_INDEX_NAME #84 in SYS_INDEXES, I had to do this:

SELECT SYS_INDEX_NAME +
  INTO vndx +
  FROM SYS_INDEXES +
  WHERE SYS_COLUMN_NAME = 'jdeslscd'

SET VAR vcmd = 'ALTER TABLE slsterms DROP CONSTRAINT'&CTXT(.vndx)
&vcmd

That worked.  But the same approach does not work for the NOT NULL constraint.

Any clues?

Emmitt Dove
Manager, Converting Applications Development
Evergreen Packaging, Inc.
[email protected]
(203) 214-5683 m
(203) 643-8022 o
(203) 643-8086 f
[email protected]

Reply via email to