Re: INSERT problem
Jerry Stuckle wrote:
> Despite other comments, the backticks around your table and column names
> are fine. They are valid for MySQL.
>
> If `id` is a numeric value, you should not have quotes around the
> numeric values, i.e. you should have (1, 'Abkhazia').
>
> Also as noted, the entry with value 54 has a single quote in it.
> Enclosing the values within double quotes is not correct, however - that
> is invalid SQL (strings must be enclosed by single quotes).
>
> The way to correct this is to have two single quotes in the string, i.e.
> 'Côte d''Ivoire'
>
> The non-ASCII characters (i.e. 'Åland') may or may not be a problem - it
> depends on the table definition.
>
> I'm not sure why this would give a timeout error, though. It shouldn't
> take long for it to be inserted. I'd recommend you break it up into
> smaller chunks and see what happens. You should be able to determine if
> there are other errors in your SQL that we've missed.
>
This does not seem to be accurate. At least as far back as MySQL
version 3.23, double-quotes are most certainly acceptable for enclosing
strings. Section 9.1.1 of the manual details this:
A string is a sequence of bytes or characters, enclosed within either
single quote (‘'’) or double quote (‘"’) characters.
Did fail to mention previously that the quotes as shown in the original
post were ASCII 60's (96 in decimal), not 27's (decimal 39). That also
caused my attempt at importing to fail.
So far as surrounding table names in the insert statement with quotes, I
couldn't find it in the manual, and it bombed when I tried it. Am
curious where you got this info.
And yes, the collation will definitely be an issue. Defining the
'country' column as utf8_general_ci, the records 4, 54 & 187 did not
import the country name. Set to ASCII, the high ascii chars imported as
question marks (Hex code 3F, ASCII 63), but the remainder of the string
came in OK.
|