Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Ingres Topics / January 2008

Tip: Looking for answers? Try searching our database.

Making a nullable column not-nullable with ALTER TABLE?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gerhard Hofmann - 18 Jan 2008 13:21 GMT
Hi all,

is it possible to change a nullable column to not-nullable with Ingres
2006's ALTER TABLE... ALTER COLUMN... command?

If yes, how would this look like?

Regards
Gerhard
Karl & Betty Schendel - 18 Jan 2008 14:36 GMT
>Hi all,
>
>is it possible to change a nullable column to not-nullable with Ingres
>2006's ALTER TABLE... ALTER COLUMN... command?
>
>If yes, how would this look like?

Converting a column from nullable to non-nullable is explicitly
checked for and disallowed.  I'm not 100% sure why, I suppose
it's because there would be no real good way of dealing with
an existing NULL at runtime.  I think I would prefer to see
it allowed, and convert existing NULL to default;  however
this is arguably less "correct".

I guess you will have to drop and re-add the column.
If the table involved doesn't have a unique key, you could
temporarily add a holding column to that table and update
it with the old column's values while you drop and recreate
the old column.

Karl
Gerhard Hofmann - 18 Jan 2008 19:11 GMT
On 18 Jan., 15:36, Karl & Betty Schendel <schen...@kbcomputer.com>
wrote:

> Converting a column from nullable to non-nullable is explicitly
> checked for and disallowed.  I'm not 100% sure why, I suppose
[quoted text clipped - 10 lines]
>
> Karl

Hello Karl,

thanks for your helpful explanation. I supposed it wouldn't work. We
already use the proposed workaround with copying the data into a
temporary / holding column.

Regards
Gerhard
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.