Re: search error



have a look at this link. It is some javascript in an html page which
will remove the noise words.

Then you would have to execute a proc like this one. If you pass it a
parameter of 1 it will do what you are looking for

searchsql1 'test test1 test2',2

CREATE procedure SearchSQL1 (@stringin varchar(200), @BooleanType int=
NULL)
as
-- a @boolean type of null means a phrase based search
-- a @boolean type of 1 means an OR type search
-- a @boolean type of 2 means an AND type search
declare @holdingString varchar(2000)
declare @whitespace int
declare @boolean varchar(10)
set @boolean=case when @booleantype is null then ' ' when
@booleantype=1
then char(34)+' OR ' + char(34) else char(34)+' AND '+char(34) end
declare @counter int
declare @posold int
declare @posnew int
set @holdingstring='select * from authors where contains(*,'''+char(34)
select @whitespace=len(@stringin) - len(replace(@stringin,' ',''))
select @posold=0
select @posnew=Charindex(' ',@stringin)
while @whitespace >=0
begin
if @whitespace=0
begin
select @holdingString=@holdingString+substring(@stringin,@posold+1,
len(@stringin)-@posold+1)+char(34)+char(39)+')'
end
else
begin
select @holdingString = case when len(substring(@stringin,@posold+1,
@posnew-@posold-1))>0 then
@holdingString+substring(@stringin,@posold+1,
@posnew-@posold-1)+@boolean else @holdingstring end
select @posold=@posnew, @posnew=Charindex(' ',@stringin, @posold+1)
end
select @whitespace=@whitespace-1
end
print @holdingstring
exec(@holdingstring)
return @@rowcount

.



Relevant Pages

  • Re: Front end website full-text search
    ... -- a @boolean type of null means a phrase based search ... DECLARE @whitespace INT ... Looking for a SQL Server replication book? ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Searching for
    ... -- a @boolean type of null means a phrase based search ... declare @holdingString varchar ... declare @whitespace int ... Given there's a lot of items in a database> and the user is looking for a "10 inch wrench" he/she is probably typing> "wrench 10 inch". ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Need simple search string converted to full-text search string
    ... declare @NumberOfRoww int ... exec @NumberOfRows =SearchSQL1 'SearchPhrase' ... -- a @boolean type of null means a phrase based search ... declare @holdingString varchar ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Google style search
    ... -- a @boolean type of null means a phrase based search ... DECLARE @whitespace INT ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Really tough ADO Stored Procedure Question. Please Help!!!
    ... @lScenarioID_CopyFrom int, ... DECLARE @ErrMSG varchar--This is the max msg size ... ROLLBACK TRANSACTION ... SELECT @lRowCountHolder = MIN ...
    (microsoft.public.sqlserver.odbc)

Loading