In order I defined a TYPE and then wrote a function to work with that.  It
allows me to treat conditions like this as if they were in a lookup table.
I do not know MSSQL well enough to know how to write the same thing in it,
but might be an idea to consider doing.

On 4/5/06, Mike Klostermeyer <[EMAIL PROTECTED]> wrote:
>
> No.  In your version, '5' would be incorrectly found in the list
> '50,150,250', whereas it would NOT be found in the SQL below.
>
> Another route to go if you are using SQL Server (possibly others as well)
> is
> to find or create a user defined function in SQL that parses lists.  I've
> used this before it works very well, though I don't know which is most
> efficient.
>
> Mike
>
> -----Original Message-----
> From: Ian Skinner [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 05, 2006 12:04 PM
> To: CF-Talk
> Subject: RE: help with list values in db
>
>
> SELECT
>        [column list]
> FROM
>        [table]
> WHERE
>        catid LIKE '#ID#'
> OR
>        catid LIKE '#ID#,%'
> OR
>        catid LIKE '%,#ID#'
> OR
>        catid LIKE '%,#ID#,%'
>
>
> Couldn't that WHERE clause be consolidated into one line such as:
>
> WHERE
>        catid LIKE '%#ID#%'
>
> Or is there some performance benefit of using the four variations?  Since
> using the LIKE clause can be a performance killer.
>
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>
> ---------
> | 1 |   |
> ---------  Binary Soduko
> |   |   |
> ---------
>
> "C code. C code run. Run code run. Please!"
> - Cynthia Dunning
>
> Confidentiality Notice:  This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the
> intended recipient, please contact the sender and
> delete any copies of this message.
>
>
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237032
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to