umm a very newbie question in querys

A

ali

well some thing is not right i think

i tried this query
recordSet = query.executeQuery("SELECT * FROM members WHERE Name LIKE
'Ali*'");

and wrote it correctly in try catch

but id didnt work

if i write my complete name instead of 'Ali*' it
works

but with the statment as it is it finds nothing

i think Stetment has some ellargy to * ( any) in sql
so can some help me with a solution for that
 
K

karlheinz klingbeil

ali schrub am Freitag, 31. Dezember 2004 13:36
folgendes:
i tried this query
recordSet = query.executeQuery("SELECT * FROM members
WHERE Name LIKE 'Ali*'");
i think Stetment has some ellargy to * ( any) in sql
so can some help me with a solution for that

So why do you ask this question an a java group instead
of a sql group ?

BTW: in most SQL Databases the wildcard Character is %
(not '*')
 
A

ali

Thanks

well i didnt knew the information about % is used in most databases i
though it is *

That solved my problem thanks a lot

i asked here because i have almost the same programe in visual basic
and the query worked there with * and didnt work here so though the
problem is in how java deal with sql commands


thanks again
 
S

Sudsy

ali wrote:
i asked here because i have almost the same programe in visual basic
and the query worked there with * and didnt work here so though the
problem is in how java deal with sql commands
<snip>

So you were doing it wrong but M$ was "helping" by translating to the
appropriate wild-card character. Makes you wonder if it translates a
period (used in REs to match a single character) to the underscore
(_) which is the proper wild-card single character match in SQL. But
that wouldn't make sense, would it?...
Bottom line: Don't EVER assume that the way that M$ does something is
the "right" way.
 
T

Thomas Kellerer

Sudsy wrote on 31.12.2004 15:40:
ali wrote:


<snip>

So you were doing it wrong but M$ was "helping" by translating to the
appropriate wild-card character.

I assume (because he used VB) he was using MS Access. In that case he *did*
it right :)
In Access the wildarcd characters are indeed * and ?

Thomas
 
S

Sudsy

Thomas Kellerer wrote:
I assume (because he used VB) he was using MS Access. In that case he
*did* it right :)
In Access the wildarcd characters are indeed * and ?

Thomas

Then it proves my point, doesn't it? Those are NOT the standard SQL
wild-cards. So you'd need one version of the code for Exlax and one
for all the other, SQL-compliant databases.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top