|
Dan, You wrote: ************************************************************************** I am setting up a dynamic SQL statement based on user input for data selection. They are able to select using wildcards, so I am using the LIKE predicate to handle this. My question is this: When the user doesn't specify wildcards, and specifies a "straight" value, is there any difference between using LIKE and an equal sign? I.e.: CUSTNAME LIKE 'BALE, DAN' CUSTNAME = 'BALE, DAN' ************************************************************************* Yep, a big difference. Equal (=) uses indexes if possible, LIKE may or may not. LIKE uses more resources. While its useful, its more costly. Equal would be a better choice if at all possible. Further, likewise, it more costly to use dynamic SQL vis. static SQL. I'd stay away from dynamic SQL when possible. But, if you have a powerful machine or the table your search is small or the dynamic and LIKE usage is small, perhaps you won't be effected much. Dave Arizona
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.