Thanks
That works nicely.

Why does that not have any effect with numeric values.
E.g. I can insert the same max numbers in a tinyint column then in a
tinyint(1) column, 

For example, how do I create a column that only allows 1 numeric value from
0 to 5?

Thanks
Olaf 


On 1/5/07 12:52 PM, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> 
> You need to set the sql_mode to STRICT_TRANS_TABLES or STRICT_ALL_TABLES.  We
> set this for the server in the my.cnf file.  Be careful, though, because there
> are some third-party  GUI clients that don't read the my.cnf file and thus
> don't set the sql_mode to what you expect.  In that case, set it yourself in
> the client: 
> 
> set SESSION sql_mode='STRICT_TRANS_TABLES';
> select @@session.sql_mode;
> 
> You can read about sql_mode here.
> 
> http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html
> 
> Donna 
> 
> 
> Olaf Stein <[EMAIL PROTECTED]> 01/05/2007 12:37 PM
> To 
> MySql <mysql@lists.mysql.com>
> cc
> Subject 
> Varchar limit warning
> 
> 
> 
> 
> Hi all
> 
> If I insert a value to great for a field (e.g. '123456' into a varchar(5)
> field), mysql runs the insert without warning or error and cuts of what
> doesn't fit.
> 
> How can I tell it to launch an error and abort the insert?
> 
> Thanks
> Olaf
> 


-------------------------
Olaf Stein
DBA
Center for Quantitative and Computational Biology
Columbus Children's Research Institute
700 Children's Drive
phone: 1-614-355-5685
cell: 1-614-843-0432
email: [EMAIL PROTECTED]

Reply via email to