Hi
I've a list of Values with varchar field in main in a table. I wanted to have fast search as there are very less insertions/updations. Thought to do a FullText Searching on that varchar field.
Imp Note: The name column can be a phrase too.
I want to search on the key stroke from front end.
so should be able to search the name column on single charater or words.
declare @a varchar(10)
--to search a single value
--@a = 'a'
select name from tablename where CONSISTS(name,@ a)
--to search a word starting with in the text
set @a = ' " ' + @a + ' *" '
select name from tablename where CONSISTS(name, @a)
--if searching a word
--@a= 'apple'
select name from tablename where CONSISTS(name,@ a)
--If searching for a phrase and its continuation
--@a = 'apple and'
select name from tablename where CONSISTS(name,' "apple and*" ') --don't result any rows
--> this all worked out fine individually
But in stored procedure I need to write only one query
How to go on with this...
as I need to use * at the end...But for the last criteria It doesn't work out...
Plz suggest me a gud way to go on...
I've a list of Values with varchar field in main in a table. I wanted to have fast search as there are very less insertions/updations. Thought to do a FullText Searching on that varchar field.
Imp Note: The name column can be a phrase too.
I want to search on the key stroke from front end.
so should be able to search the name column on single charater or words.
declare @a varchar(10)
--to search a single value
--@a = 'a'
select name from tablename where CONSISTS(name,@ a)
--to search a word starting with in the text
set @a = ' " ' + @a + ' *" '
select name from tablename where CONSISTS(name, @a)
--if searching a word
--@a= 'apple'
select name from tablename where CONSISTS(name,@ a)
--If searching for a phrase and its continuation
--@a = 'apple and'
select name from tablename where CONSISTS(name,' "apple and*" ') --don't result any rows
--> this all worked out fine individually
But in stored procedure I need to write only one query
How to go on with this...
as I need to use * at the end...But for the last criteria It doesn't work out...
Plz suggest me a gud way to go on...
Comment