title: How to fix ODBC Driver 8.0 SQL syntax error in SSIS?
body: <p>I have a SSIS package which is used to export data from a MySQL database to a SQL database.
  For some reason, I can only read data using the ODBC Source item but I cannot preview the table, also, while doing some other tests I found out I can't insert data with the ODBC Destination item either.</p>
  
  <p>Whenever I try I get this error:</p>
  
  <blockquote>
    <p>ERROR [42000] [MySQL][ODBC 8.0(w) Driver][mysqld-5.7.23]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 "<code>TABLENAME</code>"
    at line 1 (myodbc8w.dll).</p>
  </blockquote>
  
  <p>I'm using MySQL 5.7.23 and MySQL Connector/ODBC 8.0. I have tried switching between ANSI and Unicode connectors; downgrading the connectors version (tried it with 5.3, 5.2 and 5.1); changing database, table and column codification; changing the data access mode in the ODBC Source item (was using "Table Name" by default); remaking the task. Everything results in the same error, even on different computers and databases.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Using @Hadi second workaround lead to some interesting results (the first one didn't work for me).</p>
  
  <p>Using either the ADO.NET or ODBC connector, the provided query resulted in an error.</p>
  
  <blockquote>
    <p>Error Code: 1231. Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'</p>
  </blockquote>
  
  <p>After modifying the query to</p>
  
  <p><code>set sql_mode = 'STRICT_TRANS_TABLES, NO_ENGINE_SUBSTITUTION, ANSI_QUOTES'</code></p>
  
  <p>the error changed to a warning.</p>
  
  <blockquote>
    <p>set sql_mode='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES' 0 row(s) affected, 1 warning(s): 3135 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.</p>
  </blockquote>
  
  <p>Still, it worked partially. Any quotations, accents, or any other symbol surrounding any selected table name had to be removed. That made it work fine when inserting data, but when retrieving data it had to be done either from a SQL command or by creating 2 different connections.</p>