SQL Server 2008 - Search Query
        Posted  
        
            by user208662
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user208662
        
        
        
        Published on 2010-04-30T14:17:34Z
        Indexed on 
            2010/04/30
            14:27 UTC
        
        
        Read the original article
        Hit count: 332
        
sql
|sql-server-2008
Hello, I am not a SQL Expert. I’m trying to elegantly solve a query problem that others have had to have had. Surprisingly, Google is not returning anything that is helping. Basically, my application has a “search” box. This search field will allow a user to search for customers in the system. I have a table called “Customer” in my SQL Server 2008 database. This table is defined as follows:
Customer
- UserName (nvarchar) 
- FirstName (nvarchar) 
- LastName (nvarchar) 
As you can imagine, my users will enter queries of varying cases and probably mis-spell the customer’s names regularly. How do I query my customer table and return the 25 results that are closest to their query? I have no idea how to do this ranking and consider the three fields listed in my table.
Thank you!
© Stack Overflow or respective owner