How to force Warning: #1048 Column cannot be null to Error

How to force Warning: #1048 Column cannot be null to Error

am 30.01.2010 16:58:36 von Jiang Miao

When I try insert NULL to VARCHAR NOT NULL column, It will shows a
warning and convert NULL to '' then insert 。
I want to MySQL raise an exception when I try do that.
How to do that?

Thank you.
Miao


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: How to force Warning: #1048 Column cannot be null to Error

am 30.01.2010 17:28:55 von Claudio Nanni - TomTom

--001485f796e493fd87047e643f91
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Take a look at SQL_MODE ;)

Claudio

On Jan 30, 2010 5:05 PM, "Miao Jiang" wrote:

When I try insert NULL to VARCHAR NOT NULL column, It will shows a warning
and convert NULL to '' then insert ã€=82
I want to MySQL raise an exception when I try do that.
How to do that?

Thank you.
Miao


--=20
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/mysql?unsub=3Dclaudio.nanni@gmail.com

--001485f796e493fd87047e643f91--

Re: How to force Warning: #1048 Column cannot be null to Error

am 30.01.2010 17:40:16 von Wagner Bianchi

--0016e6d7856d32e5b9047e6468f9
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

mysql> SET sql_mode =3D TRADITIONAL;
Query OK, 0 rows affected (0.02 sec)

Then the insert query will fail and the row will not be added to the
table...see you.

Wagner Bianchi


2010/1/30 Claudio Nanni

> Take a look at SQL_MODE ;)
>
> Claudio
>
> On Jan 30, 2010 5:05 PM, "Miao Jiang" wrote:
>
> When I try insert NULL to VARCHAR NOT NULL column, It will shows a warni=
ng
> and convert NULL to '' then insert ã€=82
> I want to MySQL raise an exception when I try do that.
> How to do that?
>
> Thank you.
> Miao
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=3Dclaudio.nanni@gmail.com
>

--0016e6d7856d32e5b9047e6468f9--