Article View: borland.public.interbase.sql
Article #871Re: Changing column default values
From: Bob
Date: Thu, 14 Jun 2007 02:27
Date: Thu, 14 Jun 2007 02:27
66 lines
2213 bytes
2213 bytes
Ran the below sql's: CREATE DOMAIN D_VARCHARDEFAULTN VARCHAR(1) DEFAULT 'N'; ALTER TABLE PRODSTORE ALTER ISRANGED TYPE D_VARCHARDEFAULTN; insert into prodstore ( storeid, plu ) values ( '1', '1' ); select * from prodstore where storeid = '1' result ISRANGED field defaults to 'Y' Therefore it did not work. Sad. 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:
<4670a776@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!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-mailReferences:
<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 12:27:03 +1000 Lines: 68 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: <4670a776@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1181788022 203.206.159.118 (13 Jun 2007 19:27:02 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!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