🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Changing column default values

#867
From: Wayne Niddery [TeamB]
Date: Thu, 14 Jun 2007 01:23
30 lines
1667 bytes
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: <4670989e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46709339$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
Reply-To: "Wayne Niddery [TeamB]" <wniddery@chaffaci.on.ca>
From: "Wayne Niddery [TeamB]" <wniddery@chaffaci.on.ca>
Newsgroups: borland.public.interbase.sql
References: <46709339$1@newsgroups.borland.com>
Subject: Re: Changing column default values
Date: Wed, 13 Jun 2007 21:23:40 -0400
Lines: 32
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: 69.17.170.228
Message-ID: <4670989e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1181784222 69.17.170.228 (13 Jun 2007 18:23:42 -0700)
X-Authenticated-User: wniddery
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail