Solved

Freetext search problem

Posted on 2009-06-30
5
657 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now