Friday, January 15, 2010

MySQL drop column if exists

3 comments:

  1. i had an error trying to execute such script like in your example.

    "Error Code : 1064
    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 ';
    DELIMITER ';'' at line 10"

    it works after i deleted quote symbols ' near ; and ;; where delimiter is defined.

    ReplyDelete
  2. It's also wise to add " where table_schema = 'database1' " in the case where you have multiple databases using the same tables and columns

    ReplyDelete
  3. thanks
    made these changes to get working on my system
    delimiter ;;
    delimiter ;

    no ' around delimiter and tada

    ReplyDelete