Search SP to return key value pairs

  • Hello all,

    This probably going to sound like a "duhhh!" type question, but considering the fact that I have moved from a position where I was a web developer and we had a team of DBA's that did all SQL related tasks to a new position where I have to be the DBA too, I must ask.

    I am implementing an auto complete extender in a web application which will basically enable the user to do a Google style search. I need to create a stored procedure that accepts a partial string (the first three or more characters the user types into the search box) and then returns the results - company names for example - in key value pairs.

    Now, I have had some SQL experience, and am pretty sure I need to create an SP that takes the search string as a parameter, then do some kind of "LIKE" clause with a wildcard character, and select the company id (key) and company name (value) from the table - and that would serve to populate a key value pair list in C#. Does that sound about right?

    If it does, and I am just being a little paranoid that I have lost my SQL skills, I apologize. I am new at this place and want to make sure I do things right. Thank you for your time.

    q-kev

  • This might be overkill but here is an article that might be of interest to you. A forum post reminded me to it's existance.

    http://www.sqlservercentral.com/articles/Full-Text+Search+(2008)/64248/

    Dan

    If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.

  • Thanks for posting that Dan. Although it is a bit much for what I needed this time, I can see eventually having to implement something like that, so I appreciate the tip.

    Turns out that my assumptions were right on, and I created a very simple stored proc that did the trick. I am assuming that's why I didn't get any replies other than yours (because it was so simple...?) I have posted 'dumb' questions on other forums and gotten at least a few answers. I must say I am rather disappointed at the lack of response. Perhaps even the "newbie" forum is too advanced for me, eh?

    q-kev

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply