Forum Moderators: phranque
I am currently working on quering a databases table's product name column. The column has all Product names like CM08921, CM1928K, CM4013 etc... The SQL query I have written so far goes like this
SELECT Part_Number, Controller, Spec_Filename, Module_Size_W, Module_Size_H, Viewing_Area_W, Viewing_Area_H, Digit_Height
FROM dbo.LCD_CM
WHERE Part_Number LIKE '%Search%'
It works fine if you search "CM" all are returned. If you search CM1 all of the items that start with CM1 are returned, but how would I tweak the code so that say if someone types in CM1000345454 or CM3423987 (something ridiculously long that is not in the database) it would return a product number closest to what it would match. (The second I type in a search of CM2 its fine but if I do CM2000 it wont show anything even though there is a CM2021)
Thanks for any help you can offer, its greatly appreciated.
In your example above, the three 0's would eventually be removed till the script was searching for just "CM2".