Use the IF function or the the IFNULL function like this:

SELECT IF(<fieldname='','Empty Value of Your Choice',fieldname) FROM <tbl-name>;
SELECT IFNULL(<fieldname,'Default Null Value of Your Choice') FROM <tbl-name>;

If the fieldname column contains either Strings, Empty Strings or Nulls do this

SELECT IF(IFNULL(fieldname,'BLAHBLAHBLAH')='BLAHBLAHBLAH','Null Value of Your 
Choice',
IF(fieldname='','Empty Value of Your Choice',fieldname)) FROM <tbl-name>

Give it a try, it's Worth a Shot !!!

----- Original Message -----
From: "js" <[EMAIL PROTECTED]>
To: mysql@lists.mysql.com
Sent: Monday, February 12, 2007 9:48:28 AM (GMT-0500) US/Eastern
Subject: NOT EMPTY, like NOT NULL

Hi list,

A silly question.
Is it possible to prevent empty value('') from appearing in a field?

I can solve this by using subquery or trigger,
but it's a little bit painful.
The simpler the better :)

Thanks.

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



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

Reply via email to