williamsandonz
williamsandonz

Reputation: 16430

How to do partial match in full-text search in SQL Server

I have a list of places, e.g "Auckland", "Wellington".

My current implementation, won't return these rows if "Auck" or "Welli" is typed.

I am using full-text search, (as there are 30 million rows), and using:

CONTAINSTABLE([Table], [Field], 'Auck')

This works great, but how can I get it to do partial matches whilst using my full-text index?

Upvotes: 0

Views: 2467

Answers (2)

obaylis
obaylis

Reputation: 3034

I have used the following for partial matches on full-text indexed columns.

SELECT * FROM [Table] WHERE CONTAINS([Field], '"*Auck*"');

Same applies for CONTAINSTABLE

SELECT * From CONTAINSTABLE([Table], [Field], '"*Auck*"');

Upvotes: 2

TavoloPerUno
TavoloPerUno

Reputation: 579

How about

CONTAINSTABLE([Table], [Field], 'Auckland OR "Auck*"')

Upvotes: 0

Related Questions