๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Setting not NULL constraint afterwards

#11236
From: Mika Parjanen
Date: Thu, 12 Dec 2002 14:22
72 lines
2682 bytes
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: <3df89be8@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3df8363f$1@newsgroups.borland.com> <3df841c4@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 06:30:47 PST
From: "Mika Parjanen" <mika.parjanen@nisamest.fi>
Newsgroups: borland.public.interbase.sql
References: <3df8363f$1@newsgroups.borland.com> <3df841c4@newsgroups.borland.com>
Subject: Re: Setting not NULL constraint afterwards
Date: Thu, 12 Dec 2002 16:22:37 +0200
Lines: 74
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: <3df89be8@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1039703016 194.100.71.66 (12 Dec 2002 06:23:36 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail