MYSQL trigger syntax for CONCATPerformance of a Trigger vs Stored Procedure in MySQLMySQL using trigger...

What can I do to encourage my players to use their consumables?

Boss asked me to sign a resignation paper without a date on it along with my new contract

What dissuades people from lying about where they live in order to reduce state income taxes?

Is it possible to map from a parameter to a trajectory?

How can guns be countered by melee combat without raw-ability or exceptional explanations?

How to get a 2D Plot from a 3D Listplot?

Given a total recursive function, can you always compute its fixed-point?

What if I miss a connection and don't have money to book next flight?

How to draw a node with two options using TikZ graphs in LaTeX

GPSD issues on 16.4

What would be some possible ways of escaping higher gravity planets?

How can I differentiate duration vs starting time

Buying a "Used" Router

Did ancient Germans take pride in leaving the land untouched?

Lubuntu 18.10 File Manager: How to view directory tree structure?

Why "rm -r" is unable to delete this folder?

Promise.all returning empty objects

Was Opportunity's last message to Earth "My battery is low and it's getting dark"?

How do I add a strong "onion flavor" to the biryani (in restaurant style)?

Is there any danger of my neighbor having my wife's signature?

Was there a pre-determined arrangement for the division of Germany in case it surrendered before any Soviet forces entered its territory?

Why is it that Bernie Sanders is always called a "socialist"?

Putting a vertical line in each Histogram using GraphicsGrid

Is practicing on a digital piano harmful to an experienced piano player?



MYSQL trigger syntax for CONCAT


Performance of a Trigger vs Stored Procedure in MySQLMySQL using trigger instead of checkHow to commit transaction on an after update event trigger?Cannot insert row into table after creating a triggerOracle: Trigger to store username after INSERT into column of same tableWhat is missing in my trigger?How to execute AFTER INSERT TRIGGER with an auto-incremented (seq.NEXTVAL) column value in Oracle PL/SQL?Mysql trigger to update if date match and insert if no match all BEFORE INSERTWhat is wrong with this mysql trigger?Need help in creating MySQL trigger













0















I am creating a trigger which should be really easy, but I cannot get past the set @code line? What am I doing wrong? There is an ID column in the wp_users table.



CREATE TRIGGER affiliate_insert
AFTER INSERT
ON wp_users FOR EACH ROW

BEGIN

set @code = CONCAT('SOCIALBIKER',new.`ID`);

INSERT INTO `wp_pmpro_affiliates`
(
`code`, `name`, `affiliateuser`, `trackingcode`, `cookiedays`, `enabled`, `visits`
)
VALUES
(
@code,
NEW.`user_email`,
``,
30,
1,
''
);
END;








share







New contributor




Steve Newton is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I am creating a trigger which should be really easy, but I cannot get past the set @code line? What am I doing wrong? There is an ID column in the wp_users table.



    CREATE TRIGGER affiliate_insert
    AFTER INSERT
    ON wp_users FOR EACH ROW

    BEGIN

    set @code = CONCAT('SOCIALBIKER',new.`ID`);

    INSERT INTO `wp_pmpro_affiliates`
    (
    `code`, `name`, `affiliateuser`, `trackingcode`, `cookiedays`, `enabled`, `visits`
    )
    VALUES
    (
    @code,
    NEW.`user_email`,
    ``,
    30,
    1,
    ''
    );
    END;








    share







    New contributor




    Steve Newton is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I am creating a trigger which should be really easy, but I cannot get past the set @code line? What am I doing wrong? There is an ID column in the wp_users table.



      CREATE TRIGGER affiliate_insert
      AFTER INSERT
      ON wp_users FOR EACH ROW

      BEGIN

      set @code = CONCAT('SOCIALBIKER',new.`ID`);

      INSERT INTO `wp_pmpro_affiliates`
      (
      `code`, `name`, `affiliateuser`, `trackingcode`, `cookiedays`, `enabled`, `visits`
      )
      VALUES
      (
      @code,
      NEW.`user_email`,
      ``,
      30,
      1,
      ''
      );
      END;








      share







      New contributor




      Steve Newton is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I am creating a trigger which should be really easy, but I cannot get past the set @code line? What am I doing wrong? There is an ID column in the wp_users table.



      CREATE TRIGGER affiliate_insert
      AFTER INSERT
      ON wp_users FOR EACH ROW

      BEGIN

      set @code = CONCAT('SOCIALBIKER',new.`ID`);

      INSERT INTO `wp_pmpro_affiliates`
      (
      `code`, `name`, `affiliateuser`, `trackingcode`, `cookiedays`, `enabled`, `visits`
      )
      VALUES
      (
      @code,
      NEW.`user_email`,
      ``,
      30,
      1,
      ''
      );
      END;






      mysql trigger





      share







      New contributor




      Steve Newton is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Steve Newton is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Steve Newton is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 mins ago









      Steve NewtonSteve Newton

      101




      101




      New contributor




      Steve Newton is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Steve Newton is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Steve Newton is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "182"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Steve Newton is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f230608%2fmysql-trigger-syntax-for-concat%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Steve Newton is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Steve Newton is a new contributor. Be nice, and check out our Code of Conduct.













          Steve Newton is a new contributor. Be nice, and check out our Code of Conduct.












          Steve Newton is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Database Administrators Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f230608%2fmysql-trigger-syntax-for-concat%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Szabolcs (Ungheria) Altri progetti | Menu di navigazione48°10′14.56″N 21°29′33.14″E /...

          Discografia di Klaus Schulze Indice Album in studio | Album dal vivo | Singoli | Antologie | Colonne...

          How to make inet_server_addr() return localhost in spite of ::1/128RETURN NEXT in Postgres FunctionConnect to...