Posted by Ed Murphy on 12/13/06 04:25
Erland Sommarskog wrote:
> Ed Murphy (emurphy42@socal.rr.com) writes:
>> SELECT Loan#
>> FROM Table1
>> WHERE '-'+Codes+'-' like '-2-'
>> OR '-'+Codes+'-' like '-13-'
>> OR '-'+Codes+'-' like '-1-'
>
> Seems like some % are missing.
Yes, of course you're right, should be
WHERE '-'+Codes+'-' like '%-2-%'
OR '-'+Codes+'-' like '%-13-%'
OR '-'+Codes+'-' like '%-1-%'
but the approach of "use a stored procedure to copy the data to a
better-normalized table" is probably better. (Oh, and that new
table should probably have an index on the Code column.)
[Back to original message]
|