Saturday, February 25, 2012

[Match any Portion] - Possible in MSSQL?

I asked this question in the mysql forums, but I am also interested in any info regarding MSSQL. I've seen databases with search systems with the functionality I seek below. I just have no idea how they are doing it. Thank you.

We have an mysql inventory database. We want to be able to put in 4984.600 and choose "match any portion" and it finds 4984600 which is in our database.

Does Mysql have a "match any portion" search function? In this case LIKE didn't work which we tried already.

Any ideas? or are we stuck with using MSSQL. We know this will work with MSSQL.

Thank you very much. This is a huge problem for us.

JimHuh?

You want to match 44984600 to 4984.600? Are these strings or numeric data?

It makes no sense to match these "on any part". That is like saying you want to match "Betty" to "Rob", since they both contain the letter "B".

Perhaps you should explain more clearly, and include the code that you have tried.|||Hi there,

Here you can see in action what I am talking about.

First, go to this website http://www.bell-electrical.com. On the left side there is an "Inventory Search" section. Enter Part no. 4984.600 ( You don't have to enter a manufacturer, or check any radio boxes. ).

The website will now redirect to another website and display your result. It will contain the part number 4984600 without the decimal. That particular website is using an ASP script with an MSSQL backend. This is why I say it works with MSSQL. Whether it is the ASP script or something else using sql, I am not exactly sure, but they are doing something to make this work.

I am basically looking to implement something like this using php and mysql, but am unsure if it's possible. I have noticed that most big php scripts including vbulletin for example don't have this function either.

The particular company that is using this search system, is not known for custom programming. Rather they usually use basic asp and mssql systems. This also leads me to believe that it's probably not all that complex.

Any ideas on how they might be achieving this would be great. I have also heard that in MS Access there is actually some parameter that you can use to switch from a "Match" search to a "Match Portion" search. I am wondering if there is something like this in MSSQL as well.

Anyway, hopefully this reply will help everyone understand what I am trying to accomplish.

Thanks again for all the replies.|||I don't think you want to "match portion". It looks like you want to strip all non-numeric (or non-alphanumeric) characters from the string prior to doing your search. And then maybe use the LIKE operator to search as a substring of existing.

TSQL has a nice selection of character string manipulation functions you can use, depending upon the details of your situation. Lookup the REPLACE function, for instance.

No comments:

Post a Comment