When I'm running this query:
Select * from Table1 Where Column1 Like 'aaa%' --3 Result
Select * from Table1 Where Column1 Like 'a%' --3 Result
Select * from Table1 Where Column1 Like 'A%' --3 Result
but when I'm running
Select * from Table1 Where Contains(Column1 ,'aaa') --3 Result
Select * from Table1 Where Contains(Column1 ,'a') --0 Result
Select * from Table1 Where Contains(Column1 ,'A') --0 Result
CONTAINS
can search for:As Per MSDN
- A word or phrase.
- The prefix of a word or phrase.
- A word near another word.
Does that mean that Contains
can't search for letters?
If yes, then how?
Edit2:
declare @param as varchar(20)='a'
select * from table1 where Contains(column1,@param)
This is Working,
declare @param as varchar(20)='"a*"'
select * from table1 where Contains(column1,@param)
But,This is Not
declare @param as varchar(20)='a'
select * from table1 where Contains(column1,@param+'*')
And,
select * from table1 where Contains(column1,'"'+@param+'*"')
Searches for precise or fuzzy (less precise) matches to single words and phrases
.a
would probably count as noise/stop-word and be ignored. trycontains(column, 'a*')
– Officialdom