Subject RE: [ib-support] Fw: NOT NULL question
Author Martijn Tonies
Hi Helen,

One thing though, this constraint will show up as a CHECK CONSTRAINT and
will not show as a 'NOT NULL' field in the tools :)

It does work though :)

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com



At 07:32 AM 18-12-01 +0100, Nico wrote:
>Hi list,
>
> Is there a way to add a NOT NULL constraint to a column, with ALTER
TABLE ? (Interbase 6).

ALTER TABLE ADD CONSTRAINT MyColNotNull
CHECK (MyCol is not null);

I'd want to add a trigger to write a default value as well....and I'm not
sure whether Prepare marks columns thus constrained as Required Fields in
Delphi.

If the table doesn't have any dependencies, an alternative would be to
create a duplicate table with NOT NULL on that column and pump the data
across, drop the original table, then duplicate the new table the same way.

Don't forget to go through and find existing nulls first!

cheers,
Helen



[Non-text portions of this message have been removed]