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 guess it's
not the right way:
CREATE TRIGGER testref BEFORE INSERT ON bookmarks
 FOR EACH ROW
BEGIN
if NEW.title like '%xxx%'
 set NEW.id='xxx';
 END;

the error:
server version for the right syntax to use near ':
  set NEW.id='xxx' at line 4

any idea how to do that?

thanx in advance

The syntax for your IF statement isn't correct.  You need a THEN
after the condition.

http://dev.mysql.com/doc/refman/5.0/en/if-statement.html

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

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

Reply via email to