#1064.You have an error in your SQL syntax;check manual that corresponds to MySQL server version for the right syntax to use near 'NULL' at line 1 -


i have following code. getting error like:

error code: 1064. have error in sql syntax; check manual corresponds mysql server version right syntax use near 'null' @ line 1

mysql code:

set session group_concat_max_len = 8192*50; set @sql = null;  select   group_concat(distinct     concat(       'select id, "',       c.column_name,       '" word limesurvey.lime_survey_697389 '     ) separator ' union '   ) @sql information_schema.columns c c.table_name = 'limesurvey.lime_survey_697389'   , c.column_name '697389%'   order c.ordinal_position;   set @sql    = concat('select id, word                       (', @sql, ') x order id');   prepare stmt @sql; execute stmt; deallocate prepare stmt; 

can here? new mysql.

you cannot define null value @sql. instead can try this:

set @sql = ''; 

edit:

you need execute above code inside stored program or function. mysql docs says:

mysql supports if, case, iterate, leave loop, while, , repeat constructs flow control within stored programs.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -