RE: before insert trigger

2007-12-14 Thread Rolando Edwards
: Thursday, December 13, 2007 7:09 PM To: mysql@lists.mysql.com Subject: before insert trigger Is it possible for a trigger to test the data to be inserted and if it doesn't meet specific criteria not insert the data at all? I have an application that writes a lot of data to my table. I don&#

before insert trigger

2007-12-13 Thread Ed Reed
Is it possible for a trigger to test the data to be inserted and if it doesn't meet specific criteria not insert the data at all? I have an application that writes a lot of data to my table. I don't have control over this application and it writes a lot more data then I need. So I'd like to ha

Re: need help on before insert trigger

2006-10-07 Thread Patrick Aljord
On 10/7/06, Patrick Aljord <[EMAIL PROTECTED]> wrote: thanx it works the trigger is created successfully but it has no effect. here it is: delimiter // create trigger testref before insert on bookmarks for each row begin if new.title like '%xxx%' then set new.id='xxx';

Re: need help on before insert trigger

2006-10-07 Thread Patrick Aljord
thanx it works the trigger is created successfully but it has no effect. here it is: delimiter // create trigger testref before insert on bookmarks for each row begin declare dummy char(2); if new.title like '%xxx%' then set new.id='xxx'; end if; end; //create t

Re: need help on before insert trigger

2006-10-07 Thread Patrick Aljord
I meant the error is: mysql> CREATE TRIGGER testref BEFORE INSERT ON bookmarks -> FOR EACH ROW -> BEGIN -> IF NEW.title LIKE '%xxx%' THEN -> SET NEW.id ='xxx'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version f

Re: need help on before insert trigger

2006-10-07 Thread Mark Leith
Hi Patrick, Patrick Aljord wrote: I would like to prohibit the value 'xxx' on my column title, and if it does contain the value I would like to create an exception by assigning 'xxx' to the primary key id which is int(5). This is what I do but I get an error on its creation so I guess it's not

Re: need help on before insert trigger

2006-10-07 Thread Paul DuBois
At 16:23 +0200 10/7/06, Patrick Aljord wrote: I would like to prohibit the value 'xxx' on my column title, and if it does contain the value I would like to create an exception by assigning 'xxx' to the primary key id which is int(5). This is what I do but I get an error on its creation so I gues

need help on before insert trigger

2006-10-07 Thread Patrick Aljord
I would like to prohibit the value 'xxx' on my column title, and if it does contain the value I would like to create an exception by assigning 'xxx' to the primary key id which is int(5). This is what I do but I get an error on its creation so I guess it's not the right way: CREATE TRIGGER testre