First off confirm it's not a bug with sqlite2:
 
sqlite> create table Groups (name varchar(10));
sqlite> insert into Groups values('bob');
sqlite> insert into Groups values('jean-baptiste');
sqlite> select * from Groups where name='jean-baptiste';
jean-baptiste
 
If you don't get a results this way tje sqlite2 is the problem (which I doubt).
 
Then do an sql .dump of your table.
sqlite> .dump Groups
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE Groups (name varchar(10));
INSERT INTO "Groups" VALUES('bob');
INSERT INTO "Groups" VALUES('jean-baptiste');
COMMIT;
 
Then you should be able to see the SQL representation of the string and perhaps 
see what your problem is.
 
I don't know if sqlite2 has the .mode command, but if it does it's simpler yet.
 
sqlite> .mode insert
sqlite> select * from Groups where name like('%jean%');
INSERT INTO table VALUES('jean-baptiste');
 
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
 

________________________________

From: sqlite-users-boun...@sqlite.org on behalf of Igor Tandetnik
Sent: Sun 4/25/2010 10:28 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] values containing dash - not evaluated



jason d wrote:
> I believe you misunderstood my problem. Its not that records dont exist. and
> select statement for Bob does work. a select * does display all the data.
> its the names with dashes that dont shows up. and i have 40,000 records.
> any with dashes do not give any result on a pure select statement. but if I
> select on any other column and then work on the resultset it is ok. for
> example I may choose column projectname since it does not have a dash (-) in
> it. The information is clearly there, just its as if it does not equate to
> anything at all.
>
> SELECT * from Groups WHERE name = 'jean-baptiste' ; zero result.

What does this statement return:

select name, hex(name) from Groups
where name like '%jean%';

My guess is, you either have leading and/or trailing whitespace around the 
value, or the dash in the middle is not U+002D (HYPHEN-MINUS) but some other 
Unicode character that looks like a dash, e.g. U+2013 (EN DASH). The hex dump 
would tell.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to