Hi Mike,

had the same problem switching from msql to sqlite a few days ago. 
You have to use two single quoting characters '' (C style) instead of \'
and it'll work.

Stefan

Michael MacFadden schrieb:
> 
> Hi,
> 
> I am trying to insert some text into a table, but the text has some
> quote characters in it.  For example, lets say I have the following table.
> 
> CREATE TABLE test ( col1 INTEGER PRIMARY KEY NOT NULL, col2
> varchar(255)  NOT NULL default '' );
> 
> Performing the following insert won't work:
> 
> INSERT INTO test ( col2 ) VALUES ('This doesn't work');
> 
> because of the ' in the word "doesn't".  So I tried escaping the single
> quote by doing this.
> 
> INSERT INTO test ( col2 ) VALUES ('This doesn\'t work');
> 
> However this didn't work either.  I tried putting double quotes around
> the value like this:
> 
> INSERT INTO test ( col2 ) VALUES ("This doesn't work");
> 
> This particular insert worked, however there are cases where I would
> need to insert text with a double quote as well so I tried the following
> two inserts:
> 
> INSERT INTO test ( col2 ) VALUES ("Test insert with a " in the middle ");
> INSERT INTO test ( col2 ) VALUES ("Test insert with a \" in the middle ");
> 
> I already have this working in MySQL and PostgreSQL and am trying to add
> support for SQLite.  I am definitely a novice of SQLite.  Is there some
> way to properly escape single and or double quotes, or do I have some
> obvious syntactical error?  Any help would be great.  Thanks.
> 
> ~Mike

-- 
__________________________________________________________

  Stefan G. R. Finzel      Dipl. Phys. (Univ.)
  Ochsenkopfstraße 5       Phone +49 (0)9642 704448
  D - 95478 Kemnath        [EMAIL PROTECTED]
  Germany, Europe          http://www.osn.de/user/finzel
__________________________________________________________

Reply via email to