User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 423,335 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,217 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 479 | Replies: 3
Reply
Join Date: Jan 2008
Location: India
Posts: 160
Reputation: sbv is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Help needed in writing a query for Search

  #1  
May 19th, 2008
hi developers,

i am developing a s/w that need a search.

i current using "like" for search.

for ex.
  select * from Tabl1 where col1 like "% Software Developer %" And Col2 Like "% Software Developer %" 

But this is not right way. Am i right.?
Please guide me what will be the right query for search. Can anyone guide me.

Waiting for replies. Please Help asap.
Accept Challenges and Enjoy Coding... :)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2008
Location: India
Posts: 160
Reputation: sbv is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Help needed in writing a query for Search

  #2  
May 19th, 2008
Hi

i have tried something..
Here it is..

Key Word
Software Engineer Sql Server

Query
(JobDesc Like '%Software%'OR JobDesc Like '%Engineer%' OR JobDesc Like '%Sql%' OR JobDesc Like '%Server%' OR JOB_POSTING.KeySkill LIKE '%Software%'OR JOB_POSTING.KeySkill LIKE '%Engineer%' Or JOB_POSTING.KeySkill LIKE'%Sql%'Or JOB_POSTING.KeySkill LIKE'%Server%')


But some what not yet clear.

Please guide
Accept Challenges and Enjoy Coding... :)
Reply With Quote  
Join Date: Jan 2008
Location: India
Posts: 160
Reputation: sbv is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Help needed in writing a query for Search

  #3  
May 19th, 2008
hi

i did this in asp.net to create my query
 Dim KeyWord As String
        Dim JobDesc, KeySkill As String
        JobDesc = Strings.Replace(Trim(txtKeyWords.Text), " ", "%' OR JobDesc Like '%")
        KeySkill = Strings.Replace(Trim(txtKeyWords.Text), " ", "%' OR JOB_POSTING.KeySkill LIKE '%")
this will give me some search key word in right format. then i did as ..
   SSql &= " where JOB_POSTING.DelFlag='N' and (JobDesc Like '%" & JobDesc & "%' OR "
        SSql &= "  JOB_POSTING.KeySkill LIKE '%" & KeySkill & "%') and "

this is what for actualy query feed
Reply With Quote  
Join Date: Apr 2008
Posts: 295
Reputation: tesuji is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 41
tesuji tesuji is offline Offline
Posting Whiz in Training

Re: Help needed in writing a query for Search

  #4  
May 19th, 2008
Hi sbv,

Originally Posted by sbv View Post
hi developers,

i am developing a s/w that need a search.

i current using "like" for search.

for ex.
  select * from Tabl1 where col1 like "% Software Developer %" And Col2 Like "% Software Developer %" 

But this is not right way. Am i right.?
Please guide me what will be the right query for search. Can anyone guide me.

Waiting for replies. Please Help asap.

Your statement is formally correct. Only I would drop the blanks close to the wildcards %.
  select * from Tabl1 where col1 like "%Software Developer%" And Col2 Like "%Software Developer%" 

Hard to guide you because we don't know your table and your questions exactly.

krs,
tesu
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS SQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 11:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC