🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11090

Re: Setting not NULL constraint afterwards

#11090
From: Mika Parjanen
Date: Thu, 12 Dec 2002 15:17
106 lines
3749 bytes
How come I never though about that?

I will try,

thanks!

Mika

"Martijn Tonies" <m.tonies@upscene_remove.com> kirjoitti viestiss�
news:3df8a7e5@newsgroups.borland.com...
> How about adding a trigger (that fires last) that checks the field
> for NULL and sets it to 0 as default?
>
> And, of course, the NOT NULL constraint.
>
>
> --
>
> With regards,
>
> Martijn Tonies
> InterBase Workbench - the developer tool for InterBase & Firebird
> Firebird Workbench - the developer tool for Firebird
> Upscene Productions
> http://www.upscene.com
>
> "This is an object-oriented system.
> If we change anything, the users object."
>
> > The problem lies a little deeper since there are certain triggers and
> > other activities that cretes new lines to that table. I need to make
sure
> > that there is never  a line with NULL value.
> >
> > The table should be like this
> >
> > CREATE TABLE MYMISTAKE (
> >    NR  INTEGER NOT NULL,
> >    PROBLEM INTEGER NOT NULL,
> >    .....
> >   )
> >
> > or
> >
> > CREATE TABLE MYMISTAKE (
> >    NR  INTEGER NOT NULL,
> >    PROBLEM INTEGER DEFAULT 0,
> >    .....
> >   )
> >
> > but now it is
> >
> > CREATE TABLE MYMISTAKE (
> >    NR  INTEGER NOT NULL,
> >    PROBLEM INTEGER,
> >    .....
> >   )
> >
> > so I should be able to add that constraint which make that value = 0
> > if the insert don't set that PROBLEM field
> >
> > Mika Parjanen
> >
> > "Martijn Tonies" <m.tonies@upscene_remove.com> kirjoitti viestiss�
> > news:3df841c4@newsgroups.borland.com...
> > > Hi,
> > >
> > > > just a simple question:
> > > >
> > > > How can I set a field NOT NULL constraint afterwards.
> > > > There is a lot of data in that table and too much depencies
> > > > so I cannot drop and recreate that field again.
> > > >
> > > > I suppose "DEFAULT 0"  would also be enough.
> > >
> > > In IB6 or higher, it should be.
> > >
> > > Also simply filling the column yourself,
> > > UPDATE ... SET MYCOL = 0 WHERE MYCOL IS NULL
> > >
> > > would do the same thing.
> > >
> > > > This is a problem because I have triggers which
> > > > increment and decrement that value and that can't be done
> > > > if value is NULL.
> > >
> > >
> > >
> > > --
> > >
> > > With regards,
> > >
> > > Martijn Tonies
> > > InterBase Workbench - the developer tool for InterBase & Firebird
> > > Firebird Workbench - the developer tool for Firebird
> > > Upscene Productions
> > > http://www.upscene.com
> > >
> > > "This is an object-oriented system.
> > > If we change anything, the users object."
> > >
> > >
> >
> >
>
>
Technical Details
Message-ID: <3df8a8a9@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!news.stealth.net!news.stealth.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3df8363f$1@newsgroups.borland.com> <3df841c4@newsgroups.borland.com> <3df89be8@newsgroups.borland.com> <3df8a7e5@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 114a0e,71b50d57bbdad000
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-12 07:39:57 PST
From: "Mika Parjanen" <mika.parjanen@nisamest.fi>
Newsgroups: borland.public.interbase.sql
References: <3df8363f$1@newsgroups.borland.com> <3df841c4@newsgroups.borland.com> <3df89be8@newsgroups.borland.com> <3df8a7e5@newsgroups.borland.com>
Subject: Re: Setting not NULL constraint afterwards
Date: Thu, 12 Dec 2002 17:17:01 +0200
Lines: 108
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
NNTP-Posting-Host: 194.100.71.66
Message-ID: <3df8a8a9@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1039706281 194.100.71.66 (12 Dec 2002 07:18:01 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!news.stealth.net!news.stealth.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail