🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Changing column default values

#869
From: Bob
Date: Thu, 14 Jun 2007 01:57
42 lines
2087 bytes
Thank you for the solutions, thats great.
By the way, We have been using default values for a long time successfully 
in IB6 and above without ever specifying NOT NULL
I wonder where you got the idea that you had to specify NOT NULL?

Kind Regards,

Robert.

"Wayne Niddery [TeamB]" <wniddery@chaffaci.on.ca> wrote in message 
news:4670989e$1@newsgroups.borland.com...
> Bob wrote:
>> current definition of a column is :
>>
>> ISRANGED VARCHAR(1) DEFAULT 'Y'
>>
>> how could we change this to
>>
>> ISRANGED VARCHAR(1) DEFAULT 'N'
>
> Create a domain:
>
> CREATE DOMAIN D_ISRANGED CHAR(1) NOT NULL DEFAULT 'N';
>
> Now you can assign the domain:
>
> ALTER MYTABLE
> ALTER ISRANGED TYPE D_ISRANGED;
>
> Some notes:
>
> 1) While using Varchar for this field won;t cause a problem, it is a waste 
> for a single char field, you should use CHAR.
>
> 2) Default values do not work if you do not specify not null also.
>
>
> -- 
> Wayne Niddery - Winwright, Inc (www.winwright.ca)
> "The only reason some people get lost in thought is because it's
> unfamiliar territory." - Paul Fix
> 
Technical Details
Message-ID: <4670a0a0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news2.euro.net!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <46709339$1@newsgroups.borland.com> <4670989e$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,afb0f728c721965f
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Bob" <Bob@Bob.com>
Newsgroups: borland.public.interbase.sql
References: <46709339$1@newsgroups.borland.com> <4670989e$1@newsgroups.borland.com>
Subject: Re: Changing column default values
Date: Thu, 14 Jun 2007 11:57:54 +1000
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
NNTP-Posting-Host: 203.206.159.118
Message-ID: <4670a0a0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1181786272 203.206.159.118 (13 Jun 2007 18:57:52 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news2.euro.net!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail