6 Replies Latest reply: Jan 15, 2017 7:19 AM by Girirajsinh Vaghela RSS

    Insert records from load script to MySQL DB

    Evgeny Stuchalkin



      i'm trying insert records in mysql db with this code:


      LIB CONNECT TO 'amo.queue (win-lng2sl4osbd_qlik.acc)';




      load * inline



      cool, 456, qq, z

      it, 789, ww,x

      works, 1230, ee, y

      yo,1231, rr, w];


      // Getting number of records in Table

      LET V_ROWS = NoOfRows('test');


      // Loop through the records and insert into Database table

      FOR V_ROW = 0 TO V_ROWS - 1

      LET V_FIELD1 = Peek('1',V_ROW);

      LET V_FIELD2 = Peek('2',V_ROW);

      LET V_FIELD3 = Peek('3',V_ROW);

      LET V_FIELD4 = Peek('4',V_ROW);

      SQL INSERT INTO test_odbc.new_table(1,2,3,4) VALUES('$(V_FIELD1)','$(V_FIELD2)', '$(V_FIELD3)','$(V_FIELD4)');



      its returns error, whats wrong?

      ErrorSource: Microsoft OLE DB Provider for ODBC Drivers, ErrorMsg: [MySQL][ODBC 5.3(w) Driver][mysqld-5.5.53-0+deb7u1]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1,2,3,4) VALUES('cool','456', 'qq','z')' at line 1


      Ошибка произошла здесь:

      SQL INSERT INTO test_odbc.new_table(1,2,3,4) VALUES('cool','456', 'qq','z')