|
> "Dan Bale" wrote: > Subject: SQL Like vs. = sign > 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' > Dan, There is a difference - the LIKE predicate is designed to use with wildcards. Of the two statements above, if the exact value 'BALE, DAN' is found in CUSTNAME, the first statement will NOT find it but the second one will. See the LIKE Predicate section here: http://publib.boulder.ibm.com/iseries/v5r1/ic2924/info/db2/rbafzmst60.htm#HDRCH2LIKE Steve Landess Austin, Texas (512) 423-0935
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.