Like and percent character

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Like and percent character

Micka
Hi,

I'm having trouble with the percent character .....


By example in my table I have :

id name
1 micka
2 mickael

I would like to do that :

Select * from table name where name LIKE '%micka%'

with my linux c program, the result is 0

but with the sqlite3 command program it works ....

I also tested this :

Select * from table name where name LIKE 'micka%'

and this time, it works in my linux c program ...

Why ?
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Like and percent character

Kevin Martin
Are you forming your query with sprintf? It may be worth printing the query you are preparing, to make sure it says what you think it is.

Thanks,
Kev

Sent from my iPhone

> On 3 Jun 2014, at 14:53, Micka <[hidden email]> wrote:
>
> Hi,
>
> I'm having trouble with the percent character .....
>
>
> By example in my table I have :
>
> id name
> 1 micka
> 2 mickael
>
> I would like to do that :
>
> Select * from table name where name LIKE '%micka%'
>
> with my linux c program, the result is 0
>
> but with the sqlite3 command program it works ....
>
> I also tested this :
>
> Select * from table name where name LIKE 'micka%'
>
> and this time, it works in my linux c program ...
>
> Why ?
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users