Yeah there is a way to set a default value for a column,

alter table <tablename> add <column name> = <default value> <column type>

for instance try this:

---start
create table mytable (qty integer)

alter table mytable add backordered = 'n' text 1

insert into mytable qty values 3

edit all from mytable
--end

youll see that it defaulted backordered to 'n'

since you already have the column in your table your gonna have to do
something add a new column, update the table to set the new column to the
old column, remove the old column and rename the new column to backordered.

Does that make any sense?


----- Original Message -----
From: "David Torre" <[EMAIL PROTECTED]>
To: "RBASE-L Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, September 16, 2003 5:31 PM
Subject: [RBASE-L] - Re: project and null values problem


> Maybe if I explain this better, someone will have a better
> solution.  Essentially, when I insert rows into the table, I'm not
> specifying a value for backordered.  Whenever I don't mention the field,
> R:Base puts the null value -0- in the field.  I want to make it so if I
> don't specify the field backordered in my INSERT statement, backordered is
> set to 'n' instead of -0-.
>
> If the method I want is impossible to do in R:Base, I'd like to know. In
> that case, I'll use that other method you specified. I prefer to change
> this at the database level rather than at the program level.
>
> At 05:00 PM 9/16/2003 -0700, you wrote:
> >Bill Downall had the right answer. Thats how i would do it.
> >
> >On 16 Sep 2003 at 15:28, David Torre wrote:
> >
> > > That wasn't quite the solution I had in mind.  I could do that every
place
> > > that I work with the table containing "backordered," or I could set a
rule
> > > or something and make it automatic.  It seems easier to do the
> > latter.  Can
> > > I do this in R:BASE?
> > > -David
> > >
> > > At 11:26 AM 9/15/2003 -0700, you wrote:
> > > >     INSERT INTO YourTableName (BackOrdered) VALUES +
> > > >     ('n')
> > > >
> > > >
> > > >On 15 Sep 2003 at 11:08, David Torre wrote:
> > > >
> > > > > Hello there,
> > > > >
> > > > > I have a 1 character text field called backordered that I want to
> > default
> > > > > to "n."  I went into rbd and set the default value to "n," and
that
> > took
> > > > > care of all the existing fields.  However, whenever I insert rows,
> > > > > backordered is set to NULL and this is causing some problems with
a
> > > > project
> > > > > where backordered<>'y'.  Is there a rule or something I can set to
make
> > > > > sure that backordered is never set to a NULL value, that instead
of
> > NULL,
> > > > > it is set to n?
> > > > >
> > > > > -David
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >Victor Timmons
> > > >Tiz's Door Sales, Inc
> > > >425-258-2391
> > >
> > >
> >
> >
> >
> >Victor Timmons
> >Tiz's Door Sales, Inc
> >425-258-2391
>

Reply via email to