By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,806 Members | 1,829 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,806 IT Pros & Developers. It's quick & easy.

searching database

deepuv04
Expert 100+
P: 227
Hi,
I have a table Users with the columns say
UserName
FirstName
LastName
City
State
Province
Zip
Country
Location
Title
Gender
GradeLevel
Manager
Ethnicity
Department
Division
Experience
Education
TimeZone etc...

Here my requirement is implementing the search functionality which means, user can type any thing in the search box. if the enter text is matches with any of the above columns that record must be displayed on the front end.

can anybody give me the best approach to implement this functionality, another thing is there will be 100000 + records in the table.


Thanks
Nov 17 '08 #1
Share this Question
Share on Google+
3 Replies


debasisdas
Expert 5K+
P: 8,127
is that a requirment or you are asking out of curiosity ? it seems you got the idea from search option of some of the online networking sites.
Nov 17 '08 #2

deepuv04
Expert 100+
P: 227
Hi,
This is the requirement I have to implement.
Actually I am trying with the following query but I want a better approach to implement this functionality.

Expand|Select|Wrap|Line Numbers
  1. DECLARE @Str varchar(100)
  2.  
  3. SET @Str = 'Jessica'
  4.  
  5. SELECT  *
  6. FROM   Users
  7. WHERE  
  8.        ( (@Str) like ('%' + FirstName + '%') AND (FirstName is not null) )OR
  9.        ( (@Str) like ('%' + TimeZone + '%') AND (TimeZone is not null) )
  10.  
Thanks
Nov 18 '08 #3

ck9663
Expert 2.5K+
P: 2,878
I heard of FULL-TEXT search but have not really used it yet. Is that something you can use?

-- CK
Nov 18 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.