在mysql中转换mssql触发器

时间:2016-03-19 11:10:34

标签: mysql sql

我刚刚从mssql迁移到mysql,而我现在正在做的是将我在mssql中的所有触发器转换为mysql并且我发现了难以理解的东西。我正在插入一条记录 在一个名为VERSION BUILD=7400919 RECORDER=FX TAB T=1 URL GOTO=http://android-developers.blogspot.com/2011/09/preparing-for-handsets.html SET !EXTRACT_TEST_POPUP NO TAG POS=1 TYPE=P ATTR=TXT:Early<SP>this<SP>year,* EXTRACT=TXT SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.toUpperCase()") PROMPT {{!VAR1}} 的表中完成后,应该更新一个名为VERSION BUILD=10.4.28.1074 TAB T=1 TAB CLOSEALLOTHERS URL GOTO=http://demo.imacros.net/Automate/ExtractDemo TAG POS=39 TYPE=TD ATTR=TXT:* EXTRACT=TXT SET !VAR1 {{!EXTRACT}} SET !EXTRACT NULL TAG POS=40 TYPE=TD ATTR=TXT:* EXTRACT=TXT SET !VAR2 {{!EXTRACT}} SET !EXTRACT NULL TAG POS=41 TYPE=TD ATTR=TXT:* EXTRACT=TXT SET !VAR3 {{!EXTRACT}} SET !EXTRACT NULL 'Now fill them in a form. This is only one example. You could use it also as part of link URL GOTO=http://demo.imacros.net/Automate/TestForm1 TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:name CONTENT=***Extract<SP>and<SP>Fill<SP>Demo*** ' 'The variables are part of the CONTENT tag. You could use them as part of link TAG POS=1 TYPE=TEXTAREA FORM=ID:demo ATTR=NAME:Remarks CONTENT=Extraction<SP>results:<BR><BR>One<SP>dollar<SP>costs<SP>{{!VAR1}}<SP>EURO,<SP>{{!VAR2}}<SP>Pounds<SP>or<SP>{{!VAR3}}<SP>Yen. 的表,最后将该记录插入pp_change表中

profile

当我执行时,我收到此错误

photo

1 个答案:

答案 0 :(得分:0)

MySQL没有inserted的概念。它使用new变量来存储新值。所以,你应该使用它们,而不是原始表:

DELIMITER $$

CREATE TRIGGER pic_pic AFTER INSERT ON pp_change
FOR EACH ROW
BEGIN      

BEGIN             
    UPDATE profile           
        SET  profile_pix = new.pic           
        WHERE profile.email = new.email ;         

    INSERT INTO photos (email, pic, wardrobe, upload_type, pic_view, up_user_id, country, time_group, fpage)                            
        SELECT new.email, new.pic, new.wardrobe, new.upload_type, new.pic_view, new.user_id, new.country, new.time_group, new.fpage;

END$$
DELIMITER ;