title: SQL Stored Procedure String Search via Passed Parameter and Using 'LIKE' query
body: <p>I am trying to create a stored procedure that will search my table using the parameter passed by the user as it calls the SP. I would like to use the 'LIKE' query for this. So far, this is what I got.</p>
  
  <pre><code>DROP PROCEDURE IF EXISTS `SEARCH_STUDENT`$$
  CREATE
      PROCEDURE `test`.`SEARCH_STUDENT`(_textInput VARCHAR(10))
      BEGIN
  
      SELECT * FROM records WHERE `lastname` LIKE '%'+_textInput+'%';
      END$$
  </code></pre>
  
  <p>but im getting this error:</p>
  
  <pre><code>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 '@Search varchar(10);
      SET @Search=_textInput;
      SELECT * FROM records WHERE `last' at line 10
  </code></pre>
  
  <p>What I get from google are samples with fixed string to be searched. Mine depends on what the user will input in the textbox. Thanks a lot for any help in advanced.</p>