I agree with Paul, but you have to make sure states column is indexed,
otherwise......
Bill
"Paul Franz" <[EMAIL PROTECTED]> on 03/26/2003 01:48:16 PM
Please respond to "jdjlist" <[EMAIL PROTECTED]>
To: "jdjlist" <[EMAIL PROTECTED]>
cc:
Subject: [jdjlist] Re: String List Compare
I think you have the best and fastest solution in number 3. Of course if
this a filter of some sort you should be able to use the LIKE in the where
clause. For example,
select * from some_table where states like '%CA%'
Which is probably a better solution if you are doing it to filter out
records.
Paul Franz
----- Original Message -----
From: Greg Nudelman
To: jdjlist
Sent: Wednesday, March 26, 2003 1:31 PM
Subject: [jdjlist] String List Compare
I have a DB field of user-entered 2-letter states, separated by a comma.
states = "CA, OR, TX";
or it could be
states = " CA,OR,TX, HI ";
in other words, spacing is inconsistent, but case seems to be OK.
I need to relaibly and FAST! answer:
is state = "CA" in states
Any ideas?
Greg
----------------------------------------------
P.S. this is what we got so far:
1) run a perl script on DB that will remove the extra spacing
2) add the flanking commas to both:
state = ",CA,";
states = ",CA,OR,TX,HI,";
3) states.indexOf(state) != -1
Greg
---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
http://www.sys-con.com/fusetalk
---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
http://www.sys-con.com/fusetalk
******************* PLEASE NOTE *******************
This E-Mail/telefax message and any documents accompanying this
transmission may contain privileged and/or confidential information
and is intended solely for the addressee(s) named above. If you are
not the intended addressee/recipient, you are hereby notified that
any use of, disclosure, copying, distribution, or reliance on the
contents of this E-Mail/telefax information is strictly prohibited
and may result in legal action against you. Please reply to the
sender advising of the error in transmission and immediately
delete/destroy the message and any accompanying documents. Thank
you.
---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
http://www.sys-con.com/fusetalk