Sunday, February 26, 2012

Full-text search: Problem with single/double quotes

Hi,
I am developing Knowledge Database(intranet) for my compnay.
I am using SQL Server 2000 as DB and Active Server Pages as Scripting
language.
I have a table, tb_kdb with 3 fields(title,keyword,description) as text
type.
I am insering the form data into DB after encoding.for e.g
rs("title") = Server.HTMLEncode(Request.Form("txtTitle"))
I have enabled Full-text search for these 3
fields(title,keyword,description).
Now whenever i enter data in the HTML form as - Error code: "H2SCX" in the
configuration file- for tile field.
This will be stored in the DB field (title) as - Error code:
"H2SCX" in the configuration file.
After this i do "start Full Population"
But when i try to search string - H2SCX from title field i will get 0
records found.Actually i should get 1 record found.
If i remove quotes around string - H2SCX and do again Full population and
seach, i get 1 record found.
I feel the problem is due to te quotes around string. I am facing this
problem for single & double quotes.
There are number of FAQs on our intranet site which has single or double
quotes...when searched those records will not be diaplayed.
I tried the below queriy on Sql Query Analyser
SELECT title FROM tb_kdb WHERE CONTAINS(title,'H2SCX')
SELECT @.@.Version output:
Microsoft SQL Server 2000 - 8.00.818 (Intel X86) May 31 2003 16:08:15
Copyright (c) 1988-2003 Microsoft Corporation Standard Edition on Windows
NT 5.0 (Build 2195: Service Pack 4)
Any help or suggestion on this is higly appreciated.
Thanks & Best Rgds,
Surjit
replace your single quotes with two single quotes, and your double quotes
with two double quotes.
"Surjit Madiwalar" <sursatraj@.hotmail.com> wrote in message
news:ua3qw78FEHA.684@.tk2msftngp13.phx.gbl...
> Hi,
> I am developing Knowledge Database(intranet) for my compnay.
> I am using SQL Server 2000 as DB and Active Server Pages as Scripting
> language.
> I have a table, tb_kdb with 3 fields(title,keyword,description) as text
> type.
> I am insering the form data into DB after encoding.for e.g
> rs("title") = Server.HTMLEncode(Request.Form("txtTitle"))
> I have enabled Full-text search for these 3
> fields(title,keyword,description).
> Now whenever i enter data in the HTML form as - Error code: "H2SCX" in the
> configuration file- for tile field.
> This will be stored in the DB field (title) as - Error code:
> "H2SCX" in the configuration file.
> After this i do "start Full Population"
> But when i try to search string - H2SCX from title field i will get 0
> records found.Actually i should get 1 record found.
> If i remove quotes around string - H2SCX and do again Full population and
> seach, i get 1 record found.
> I feel the problem is due to te quotes around string. I am facing this
> problem for single & double quotes.
> There are number of FAQs on our intranet site which has single or double
> quotes...when searched those records will not be diaplayed.
> I tried the below queriy on Sql Query Analyser
> SELECT title FROM tb_kdb WHERE CONTAINS(title,'H2SCX')
> SELECT @.@.Version output:
> Microsoft SQL Server 2000 - 8.00.818 (Intel X86) May 31 2003 16:08:15
> Copyright (c) 1988-2003 Microsoft Corporation Standard Edition on Windows
> NT 5.0 (Build 2195: Service Pack 4)
>
> Any help or suggestion on this is higly appreciated.
> Thanks & Best Rgds,
> Surjit
>
>
>

No comments:

Post a Comment