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


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    
http://lists.mysql.com/[EMAIL PROTECTED]


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



CONFIDENTIALITY NOTICE:This email is intended solely for the person or 
entity to which it is addressed and may contain confidential and/or 
protected health information.  Any duplication, dissemination, action 
taken in reliance upon, or other use of this information by persons or 
entities other than the intended recipient is prohibited and may violate 
applicable laws.  If this email has been received in error, please notify 
the sender and delete the information from your system.  The views 
expressed in this email are those of the sender and may not necessarily 
represent the views of IntelliCare.

Reply via email to