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 2005 Forums
 Transact-SQL (2005)
 Advance Search

Author  Topic 

swathigardas
Posting Yak Master

149 Posts

Posted - 2009-06-17 : 05:57:26
Hi , i need to write a stored procedure which facilitates easier search. A user can enter anything in the text box provided to him.
Basically i have table employee like this

Employee_Code
First_NM
Last_NM
Department_NM.

search needs to be performed on all the columns. Suppose if he give the value as Accounts or ProjectDelivery , then i need to display employee details of both departements.

he can give the value in double quotes "Accounts" which means , records which have the exact match as accounts (for name or department )should be displayed.
If the values entered is in single quotes, then single quotes should be ignored and search should be performed. Whole functionality should be like as google search . Is it possible. Please suggest me.

Thanks before hand

nr
SQLTeam MVY

12543 Posts

Posted - 2009-06-17 : 08:19:16
Not sure what you really want - can you give some examples.
I suspect you first need to parse the entry value and then do the search.

Also suspect you might need a full text index for performance.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-17 : 08:38:48
Have you tried FULLTEXT? It very much has same search syntax as Google.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-17 : 10:39:57
see more details here
http://www.sqlteam.com/article/full-text-indexing-overview-and-installation
Go to Top of Page
   

- Advertisement -