p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: RE: using LIKE % - help needed


Message #1 by "Drew, Ron" <RDrew@B...> on Mon, 10 Jun 2002 10:38:15 -0400
select * from customer where customername like '" & alpha & "%' OR
SUBSTRING(" & alpha & "1,1) BETWEEN '0' AND '9'"


-----Original Message-----
From: Chirag Shah [mailto:chiragiit@y...]
Sent: Sunday, June 09, 2002 8:47 PM
To: ASP Databases
Subject: [asp_databases] RE: using LIKE % - help needed


I did that but not all customer name do not start with "1" like "1500
northshore drive"

some of them are "2600 Michigan ave" is there any way I can query all
the customers
whose name start with a number.?

Reason on my asp I have menu like below:
No.  'A' 'B' 'C' 'D' E.....and clicking on 'A' will bring customers name
start from 'A'

but I want to have only one character for number so that by clicking it
I can get all
the customers whose name start with number..?


Any idea..


> Just pass the first digit, for example:

alpha =3D "1"
select * from customer where customername like '" & alpha & "%'"

This will return all customers whose name start with the number 1.

-Kim

> -----Original Message-----
> From: Chirag Shah [mailto:chiragiit@y...]
> Sent: 9. juni 2002 20:30
> To: ASP Databases
> Subject: [asp_databases] using LIKE % - help needed
>
>
>
> SQLQuery =3D "Select * from customer where customername like'"& Alpha 
&
> "%'"
>
> I am passing *Alpha* in a querystring for eg. if Alpha=3D"a" it gives 
me

> all the customer name starting with 'a'. If Alpha=3D"b" it gives me 
all
> the customer name starting with "b"
>  but some of my customers have name like '2600 Lake shore Drive' in
this
> case how I use above query so it gives me all the customer name
starting
> with a number for eg. "1500 Michigan Ave" (Yes this is a customer
name)

Message #2 by "Chirag Shah" <chiragiit@y...> on Mon, 10 Jun 2002 00:47:22
I did that but not all customer name do not start with "1" like "1500 northshore drive"

some of them are "2600 Michigan ave" is there any way I can query all the customers 
whose name start with a number.?

Reason on my asp I have menu like below:
No.  'A' 'B' 'C' 'D' E.....and clicking on 'A' will bring customers name start from 'A' 

but I want to have only one character for number so that by clicking it I can get all 
the customers whose name start with number..?


Any idea.. 


> Just pass the first digit, for example:

alpha = "1"
select * from customer where customername like '" & alpha & "%'"

This will return all customers whose name start with the number 1.

-Kim

> -----Original Message-----
> From: Chirag Shah [mailto:chiragiit@y...]
> Sent: 9. juni 2002 20:30
> To: ASP Databases
> Subject: [asp_databases] using LIKE % - help needed
>
>
>
> SQLQuery = "Select * from customer where customername like'"& Alpha & "%'"
>
> I am passing *Alpha* in a querystring for eg. if Alpha="a" it
> gives me all
> the customer name starting with 'a'. If Alpha="b" it gives me all the
> customer name starting with "b"
>  but some of my customers have name like '2600 Lake shore Drive' in this
> case how I use above query so it gives me all the customer name starting
> with a number for eg. "1500 Michigan Ave" (Yes this is a customer name)

Message #3 by "Chirag Shah" <chiragiit@y...> on Sun, 9 Jun 2002 20:29:51
SQLQuery = "Select * from customer where customername like'"& Alpha & "%'"

I am passing *Alpha* in a querystring for eg. if Alpha="a" it gives me all 
the customer name starting with 'a'. If Alpha="b" it gives me all the 
customer name starting with "b" 
 but some of my customers have name like '2600 Lake shore Drive' in this 
case how I use above query so it gives me all the customer name starting 
with a number for eg. "1500 Michigan Ave" (Yes this is a customer name)
Message #4 by "Kim Iwan Hansen" <kimiwan@k...> on Sun, 9 Jun 2002 21:40:33 +0200
Just pass the first digit, for example:

alpha = "1"
select * from customer where customername like '" & alpha & "%'"

This will return all customers whose name start with the number 1.

-Kim

> -----Original Message-----
> From: Chirag Shah [mailto:chiragiit@y...]
> Sent: 9. juni 2002 20:30
> To: ASP Databases
> Subject: [asp_databases] using LIKE % - help needed
>
>
>
> SQLQuery = "Select * from customer where customername like'"& Alpha & "%'"
>
> I am passing *Alpha* in a querystring for eg. if Alpha="a" it
> gives me all
> the customer name starting with 'a'. If Alpha="b" it gives me all the
> customer name starting with "b"
>  but some of my customers have name like '2600 Lake shore Drive' in this
> case how I use above query so it gives me all the customer name starting
> with a number for eg. "1500 Michigan Ave" (Yes this is a customer name)


  Return to Index