#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0

    MySQL script/encoding/command line problem


    I would love for someone more knowledgeable than me to point out what the %¤&/ I am doing wrong trying to test an MySQL script on the command line:

    Code:
    drop database movies; 
    create database movies;
    
    use movies;
    create table movie (
    	id int not null auto_increment,
    	title varchar(50),
    	year int,
    	price decimal(8,2),
    	primary key(id)
    );
    
    insert into movie (title,year,price) values (”The Great Race”, 1965, 12.95);
    Completely irrespectively of what I do, no matter which file format I try to store the script in, no matter which encoding I attempt, I always get the same error message:

    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 'öThe Great Raceö, 1965, 12.95)' at line 1

    Of course, the 'ö' can be traded for a number of other erroneous characters depending on the file format/encoding of the source file, but never the right one, double quotation marks as in the source file itself.

    Big up to anyone who can his provide any answers or pointers to where I can read up on this specific problem.
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,204
    Rep Power
    4279
    the error message points to exactly what's wrong -- the microsoft smart quotes, ” = hex 94 (dec 148)

    those are not the same as double quotes, which are " = hex 22 (dec 34)

    in any case, you should be using single quotes, ' = hex 27 (dec 39)

    only mysql allows using the double quote to delimit character strings, standard sql and all other database systems prefer the single quote
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0
    Thanks 1,000,000, r937.

IMN logo majestic logo threadwatch logo seochat tools logo