Solved

Freetext search problem

Posted on 2009-06-30
5
695 Views
Last Modified: 2012-05-07
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???
0
Comment
Question by:leap29
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 5

Expert Comment

by:rizwanidrees
ID: 24743768
Replace Null with Space or %
0
 

Author Comment

by:leap29
ID: 24744052
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
 
LVL 5

Expert Comment

by:rizwanidrees
ID: 24745606
You can write this query as

select * from jobs where Jobtitle like '%<user input text>%'
0
 
LVL 5

Expert Comment

by:rizwanidrees
ID: 24745655
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
 
LVL 5

Accepted Solution

by:
rizwanidrees earned 500 total points
ID: 24745663

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

if @searchword = ''

select * from jobs

else
select * from jobs where freetext(Jobtitle
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question