View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 11:29 AM
Michael Fesser
 
Posts: n/a
Default Re: Preventing Negative values in table.

..oO(nopam_pcartier@atlashosting.com)

>Lets say I have a table:
>
>create table test(
> ID int unsigned default 0);
>
>
>
>If someone was to update the table with the following statment:
>UPDATE test SET ID = ID - 1
>
>And the ID in the field was 0, this would cause a large numeric value
>because it's an unsigned int,
>is there a way to prevent this from happening, in the form of some trigger
>or so.


Your application should catch that, not the DB. Don't let your users
submit such values.

Micha
Reply With Quote