Board index » delphi » Using wildcards in Delphi SQL (ANSI 92-SQL) ?

Using wildcards in Delphi SQL (ANSI 92-SQL) ?

Hi,

I tried to execute the following SQL-Statement:

Select * from <tablename> where <fieldname> like 'Country*'

When ever I tried to execute this query i never got a result.
In MS Access those wildcard containing queries are working
properly. What`s wrong?

I'm looking forward to Your early reply

thanks in advance

Yours Alexander Voss

PS: We are using Delphi 2.0 C/S

 

Re:Using wildcards in Delphi SQL (ANSI 92-SQL) ?


Quote
> I tried to execute the following SQL-Statement:

> Select * from <tablename> where <fieldname> like 'Country*'

> When ever I tried to execute this query i never got a result.

        You need to use ANSI SQL instead of Microsoft.

        'Country%'

Re:Using wildcards in Delphi SQL (ANSI 92-SQL) ?


Quote
Alexander Voss wrote:

> Hi,

> I tried to execute the following SQL-Statement:

> Select * from <tablename> where <fieldname> like 'Country*'

> When ever I tried to execute this query i never got a result.
> In MS Access those wildcard containing queries are working
> properly. What`s wrong?

> I'm looking forward to Your early reply

> thanks in advance

> Yours Alexander Voss

> PS: We are using Delphi 2.0 C/S

Depends on your server's SQL syntax. Have you tried:
  " where <<field>> like 'Country%' " - using a %, not a * ?

-Bryan

Re:Using wildcards in Delphi SQL (ANSI 92-SQL) ?


Quote
In article <31AC8CA8....@creditreform.de>, Alexander Voss <a.v...@creditreform.de> wrote:
>Hi,

>I tried to execute the following SQL-Statement:

>Select * from <tablename> where <fieldname> like 'Country*'

>When ever I tried to execute this query i never got a result.
>In MS Access those wildcard containing queries are working
>properly. What`s wrong?

>I'm looking forward to Your early reply

>thanks in advance

>Yours Alexander Voss

>PS: We are using Delphi 2.0 C/S

The wildcard  character you are looking for is '%'.  For example:

Select * from <tablename> where <fieldname> like 'Country%'

Regards,
Bruce

Re:Using wildcards in Delphi SQL (ANSI 92-SQL) ?


Quote
Alexander Voss wrote:

> Hi,

> I tried to execute the following SQL-Statement:

> Select * from <tablename> where <fieldname> like 'Country*'

> When ever I tried to execute this query i never got a result.
> In MS Access those wildcard containing queries are working
> properly. What`s wrong?

> I'm looking forward to Your early reply

> thanks in advance

> Yours Alexander Voss

> PS: We are using Delphi 2.0 C/S

  You want a percent sign "%" to represent a wildcard of any number of
characters.

Peter

Re:Using wildcards in Delphi SQL (ANSI 92-SQL) ?


Quote
>   Alexander Voss wrote:

>   > Hi,

>   > I tried to execute the following SQL-Statement:

>   > Select * from <tablename> where <fieldname> like 'Country*'

>   > When ever I tried to execute this query i never got a result.
>   > In MS Access those wildcard containing queries are working
>   > properly. What`s wrong?

>   > I'm looking forward to Your early reply

>   > thanks in advance

>   > Yours Alexander Voss

>   > PS: We are using Delphi 2.0 C/S

>     You want a percent sign "%" to represent a wildcard of any number of
>   characters.

And '_' character to represent a wildcard for one character.
---
Igor Podolsky       ! While the sun hangs in the sky and the desert has sand
(igoryok@vangolay.  ! While the waves crash in the sea and meet the land...  
   carrier.kiev.ua) !                                             (Queen'91)

Other Threads