List:General Discussion« Previous MessageNext Message »
From:Christian Mack Date:June 1 1999 6:43pm
Subject:Re: Disallow Blank fields
View as plain text  
Derek Lavine wrote:
> 
> Is there any way I can prevent rows being inserted when they have
> certain columns specified as empty strings
> 
> for example I know I can prevent rows being inserted where no value has
> been specified
> 
> CREATE TABLE job
> ( job_number char(5) Default '00000' NOT NULL
> , client char(40) NOT NULL
> , Primary Key (job_number)
> , Unique id (job_number)
> );
> 
> disallows
> 
> insert into job values ( '00001'');
> 
> but still allows
> 
> insert into job values ( '00001', '');
> 
> is there anyway to force the client field to have to containe values.
> 
> Also is there anyway to ensure that job_number contains no spaces. Or
> more specificly can I ensure that it only contains 0..9 and a-z or A-Z
> 
> Of course I realise I can do this at the application level but I was
> hoping I could add these restrictions to the database schema.
> 
> Thanks for any suggestions
> 
> Derek

Hi Derek

You can't do this through the database schema.

Tschau
CHristian

Thread
Disallow Blank fieldsDerek Lavine1 Jun
  • Re: Disallow Blank fieldsChristian Mack1 Jun