: 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
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
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';
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
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
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
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
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