From: Michael Dykman Date: December 20 2010 11:25pm Subject: Re: Trigger? List-Archive: http://lists.mysql.com/mysql/223855 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The expression you supplied looks right enough.. how was it declared? as an on UPDATE/on INSERT trigger or just a single case? - michael dykman On Mon, Dec 20, 2010 at 5:21 PM, Jerry Schwartz wrote: > I've never used a trigger before, and I want to make one that sounds like= it > should be simple. > > Create Table: CREATE TABLE `testtrigger` ( > =A0`id` int(10) unsigned NOT NULL AUTO_INCREMENT, > =A0`foo` char(10) NOT NULL, > =A0PRIMARY KEY (`id`) > ) ENGINE=3DInnoDB AUTO_INCREMENT=3D4 DEFAULT CHARSET=3Dutf8 > > Here's what I want to do: if no value is supplied for `foo`, or if a NULL > value is supplied for `foo`, I want to set it to a particular value. > > I tried things like this: > > SET NEW.foo =3D IFNULL(NEW.foo,'ok') > > But that didn't work. > > If you point me in the right direction, I'll be okay from there (I hope). > > Thanks. > > Regards, > > Jerry Schwartz > Global Information Incorporated > 195 Farmington Ave. > Farmington, CT 06032 > > 860.674.8796 / FAX: 860.674.8341 > E-mail: jerry@stripped > Web site: www.the-infoshop.com > > > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: =A0 =A0http://lists.mysql.com/mysql?unsub=3Dmdykman@gmail= .com > > --=20 =A0- michael dykman =A0- mdykman@stripped =A0May the Source be with you.