Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Create a simple Search.

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2006-12-08 : 18:11:48
Hello,

I have a table with two fields: [Title] and [Description].

In my web site I have a text box where the user inserts some keywords:
'book english'
Or if possible even using some basic logic:
'book AND english', 'book OR english'

I need to do a search within the [Title] and [Description] table fields and select records which satisfy the search.

I don't need to use FullText. I would prefer a simple procedure.
My table will never have more then 2000 records.

Could someone, please help, me?

Thank You,
Miguel

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-12-08 : 18:21:54
Take a look at the application used to run these forums
Snitz Forums 2000 - free download from http://forum.snitz.com

In the search.asp page you'll see exactly how it's done.
Go to Top of Page

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2006-12-08 : 18:35:55
quote:
Originally posted by snSQL

Take a look at the application used to run these forums
Snitz Forums 2000 - free download from http://forum.snitz.com

In the search.asp page you'll see exactly how it's done.



Hi,

I looked and I got completely lost.
My idea was to use the SQL command CONTAINS.
When the user inserts some code in the textbox I would validate it using some .NET parser to check if the code could be used in the stored procedure. If yes, I then would send it as a parameter and insert the entire line inside CONTAINS.

What do you think?

Thanks,
Miguel

Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-12-08 : 18:55:35
You said you don't want to use FullText indexes, CONTAINS is for FullText queries.

The code in Snitz basically does exactly what your stored procedure or .NET code needs to do (you can choose where you'd rather write that code) - it would be simpler to do it in the .NET code because Snitz has pretty much written it for you, to write it in a proc will require you to figure the equivalent T-SQL.
Go to Top of Page
   

- Advertisement -