Solved

Freetext search problem

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Impove long SQL Stored Procedure Performance 14 75
Passing value to a stored procedure 8 100
SQL Restore Script - Syntax Error 8 97
Addition to SQL for dynamic fields 6 38
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

809 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