title: if statement of mysql in text file of .sql executed by batch file
body: <p>I'd like first introduce my requirement. I have a batch file which will execute a Textfile of sql. And I need the function that the program will first check the count of a table, if it is 0, then insert rows.
     In the following is my code.
     I was told error:</p>
  
  <pre><code>RROR 1064 (42000) at line 15: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
  nnear 'IF @a&gt;0
  THEN
  INSERT IGNORE INTO `martin1` (`col1`, `col2`) VALUES (1, 'aaa'),(' at line 1
  </code></pre>
  
  <p>Allthough I have tried some other ways such as adding ";",deleting ";", but it still does not work.</p>
  
  <pre><code>SET @a=(SELECT count(*) FROM `martin1`);
  IF @a&gt;0 
  THEN 
  INSERT IGNORE INTO `martin1` (`col1`, `col2`) VALUES (1, 'aaa'),(2, 'bbb');
  END IF;
  </code></pre>