0

I have a database table that looks like this i.e. address is a free text field (I did not design it):

5 records from the Address Table:
1 The street
2 Pine Street,Lincoln,Lincolnshire
77 Drove Way,Grantham
Drove Way Lincoln
Some house on Ambleside

I have an application that has an address field that is free text (again I did not design it). I want a user to start typing an address into the address field and then a list of Possibles to appear (hopefully just one). I have thought of a few ways to approach this:

1) Use a LIKE statement e.g. select * FROM dbaddress where address like '%1 The Street%'.  This seems like a bad idea.
2) Free text search.  I have not used this before.

Which is the "better option" for my requirements. Is there an alternative approach?

w0051977
  • 15,099
  • 32
  • 152
  • 329

1 Answers1

0

I have had something like this before and free text was a better a option in my case. If you can use LIKE 'abc%' which you use an index is also a better option.

For a field like address it's better to search with begin with.

At the end based on your needs, If I were you I would execute both queries and compare them in execution plan.

sqluser
  • 5,502
  • 7
  • 36
  • 50