Freetext search problem

I have a sp that uses a freetext search to search a table in my database from a web fronty end text box.  The problem i'm  having is that when a value is null it throws up this error "Null or empty full-text predicate" is there a way I could make it search the whole table when the contents of the text box is null/empty???
leap29Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
rizwanidreesConnect With a Mentor Commented:

declare @searchword nvarchar(50)
set @searchword = ''

if @searchword = ''

select * from jobs

else
select * from jobs where freetext(Jobtitle
0
 
rizwanidreesCommented:
Replace Null with Space or %
0
 
leap29Author Commented:
Thanks for the reply I've tried that and it doesn't seem to work.
e.g
declare @searchword nvarchar(50)
set @searchword = '%'
select * from jobs where freetext(Jobtitle

This should return about 5000 records but it's returning none at the moment.
0
 
rizwanidreesCommented:
You can write this query as

select * from jobs where Jobtitle like '%<user input text>%'
0
 
rizwanidreesCommented:
sorry, ignore my earlier comment, Try this

declare @searchword nvarchar(50)
set @searchword = ''

if @searchword = ''

select * from jobs where freetext(Jobtitle

else

select * from jobs

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.