Yes you would have to have an OR for each area code in your list in
addition to the in clause (which is expanded by the DBMS to a list of
OR's anyway which is why it is likely to run slowly).
This will extract the records you need - after that you will have to be
able to parse the memo field to extract the actual telephone numbers
that match your area codes.
In '%,nnn%' the first % recognizes that this value can have any number
of characters before it in the memo field. The ',' (comma) is the marker
which matches to the start of the numbers otherwise we would match where
area codes happen to crop up elsewhere in the numbers, the 'nnn' is the
area code we are trying to match and the last % recognizes that there
can be any number of characters following the area code.
HTH
Michael Traher
-----Original Message-----
From: Mickael [mailto:[EMAIL PROTECTED]
Sent: 21 November 2003 17:56
To: CF-Talk
Subject: Re: SQL Help
Hi Michael,
Thanks for the response. Please excuse me if this is obvious as I don't
see it. How would I extract on the numbers I need using the below. If
I have 20 area codes would I need to make the first in (then the 20 area
codes) then OR for each areacode ?
Thanks
Mike
----- Original Message -----
From: Michael Traher
To: CF-Talk
Sent: Friday, November 21, 2003 12:44 PM
Subject: RE: SQL Help
(Left(phone_list,3) in ('212','213') OR phone_list like '%,212%' OR
phone_list like '%,213%')
but I would predict poor performance.
No chance to change the database I guess?
Michael Traher
-----Original Message-----
From: Mickael [mailto:[EMAIL PROTECTED]
Sent: 21 November 2003 17:23
To: CF-Talk
Subject: SQL Help
Hello All,
I have a memo field in SYBASE that contains phone numbers delimited by
a
comma.
I need to qualify telephone numbers that are in a group of area codes,
using SQL only I can't use CF.
The is called phone_list and the values look like this
"2125551212,213555-1212,2145551212"
How could I in SQL only grab telephone # with area codes that are in
my
list.
I was thinking to do where Left(phone,3) in (212,213)
But how to a parse through the memo field.
Thanks
Mike
_____
_____
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- Re: sql help Jamie Jackson
- RE: SQL help Dave Watts
- SQL Help Allan Clarke
- SQL Help Cedric Villat
- RE: SQL Help Tony Weeg
- RE: SQL Help Tony Weeg
- Re: SQL Help Donnie Bachan
- SQL Help Mickael
- RE: SQL Help Michael Traher
- Re: SQL Help Mickael
- Re:SQL Help Michael Traher
- Re:SQL Help Stan Winchester
- SQL Help Mickael
- RE: SQL Help Cantrell, Adam
- SQL Help Bruce, Rodney S HQISEC/Veridian IT Services
- Re: SQL Help Jeff Small
- RE: SQL Help Mark A. Kruger - CFG
- RE: SQL Help Ian Skinner
- RE: SQL Help Jochem van Dieten
- RE: SQL Help Ciliotta, Mario
- RE: SQL Help Bruce, Rodney S HQISEC/Veridian IT Services