Error performing query 'DROP TABLE IF EXISTS `xxx`; ': You have an error ...

Discussion in 'Databases' started by jeeplaw, Feb 8, 2008.

  1. #1
    For the life of me, i can't figure out where that strange character is coming from. I'm loading a sql dump into a blank db, and i made sure that the sql dump is devoid of any strange characters. Opened and saved it in both notepad adn pspad.
    I thought maybe that this line would be of interest:

    ENGINE=MyISAM DEFAULT CHARSET=latin1;

    But changing it to just ENGINE=MyISAM; doesn't really have an effect.

    The good thing is that the rest of the sql dump install goes smooth since it's a fresh db. My only concern is where that strange character, on line 1 no less is coming from.

    Any ideas?

    
    DROP TABLE IF EXISTS `xxx`;
    CREATE TABLE `articles` (
      `xxx` int(11) NOT NULL auto_increment,
      `xxx` int(11) NOT NULL,
      `xxx` int(11) NOT NULL,
      `xxx` text NOT NULL,
      `xxx` text NOT NULL,
      `xxx` longtext NOT NULL,
      `xxx` tinyint(1) NOT NULL,
      `xxx` float(8,2) NOT NULL,
      `xxx` int(11) NOT NULL,
      `xxx` int(11) NOT NULL,
      `xxx` int(11) NOT NULL,
      `xxx` int(11) NOT NULL,
      `xxx` tinyint(1) NOT NULL,
      `xxx` tinyint(1) NOT NULL,
      PRIMARY KEY  (`axxxID`)
    ) ENGINE=MYISAM CHARSET=latin1;
    
    Code (SQL):
     
    jeeplaw, Feb 8, 2008 IP
  2. richRemer

    richRemer Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Those characters are the an ASCII rendering of the UTF-8 Byte Order Mark. Most UTF-8 is perfectly valid ASCII, so often you won't even realize you're using UTF-8 encoded files with ASCII-only interpreters. But, some characters in UTF-8 can show up in ASCII in either little-endian or big-endian form. To indicate to the interpreter which version the UTF-8 data uses, the Byte Order Mark character (0xFEFF) is inserted into the beginning of the data. If the interpreter doesn't follow this (non-standard but common) convention, it instead interprets the character as those three ASCII chars you are seeing.

    The solution is to simply save your file as UTF-8 without BOM or as plain ASCII (if you are not using any non-ASCII characters).
     
    richRemer, Apr 28, 2010 IP