Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
swarnendu
Contributor II

how to insert data into mysql database using qlikview

Hi all,

I am facing a problem to insert data into mysql database.

I will create a schema in mysql server and create a table which name is sale in those schema, i have a excel file which have a same filed name as it is sale table.

I want to insert excel file data into mysql database and also i create normal sql write back script but its give me a error .

which is attached .

if you have any solution then please suggest me.

Thanks in advance

Swarnendu.

mysql database version is MySql.Workbench 6.3

and my qlikview version is 11.20

my script is

sale2:

LOAD %key,

     #Amount,

     Desc

FROM

(qvd);

LET V_ROWS = NoOfRows('sale2');

FOR V_ROW = 0 TO $(V_ROWS) - 1

LET V_FIELD1 = Peek('%key',V_ROW);

LET V_FIELD2 = Peek('#Amount',V_ROW);

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

SQL INSERT INTO sale3 ([%key],[#Amount],[Desc])

VALUES ('$(V_FIELD1)','$(V_FIELD2)','$(V_FIELD3)');

NEXT;

error.....

SQL##f - SqlState: 37000, ErrorCode: 1064, ErrorMsg: [MySQL][ODBC 5.3(w) Driver][mysqld-5.7.20-log]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 '[%key],[#Amount],[Desc])

VALUES ('1000','555','Don')' at line 1

SQL INSERT INTO sale3 ([%key],[#Amount],[Desc])

VALUES ('1000','555','Don')


err.png

1 Solution

Accepted Solutions
Sergey_Shuklin
Valued Contributor

Re: how to insert data into mysql database using qlikview

Hello!

Try without this row "([%key],[#Amount],[Desc])"

Just:

SQL INSERT INTO sale3

VALUES ('$(V_FIELD1)','$(V_FIELD2)','$(V_FIELD3)');

View solution in original post

4 Replies
Sergey_Shuklin
Valued Contributor

Re: how to insert data into mysql database using qlikview

Hello!

Try without this row "([%key],[#Amount],[Desc])"

Just:

SQL INSERT INTO sale3

VALUES ('$(V_FIELD1)','$(V_FIELD2)','$(V_FIELD3)');

View solution in original post

swarnendu
Contributor II

Re: how to insert data into mysql database using qlikview

Thanks Its Works..

Partner
Partner

Re: how to insert data into mysql database using qlikview

Hi guys,

I have a similar requirement. Used the above suggestion for the syntax but still getting the same error as documented above.Did you use an ODBC or OLEDB driver?

Thanks,

Joseph

swarnendu
Contributor II

Re: how to insert data into mysql database using qlikview

ODBC connection