Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-server-2005 C#
Hi all
 
Please tell me how to code to search a full sentence in C# application..
e.g. "What is your name"-i want to search this
so if all words are present then it should return the same else if few words matches then that also it should return..
 
i m using sql-server 2005 and visual studio 2008
 
waiting for ur replies.
Thank you
Posted 8-Oct-12 23:26pm
Edited 8-Oct-12 23:49pm
v3
Comments
   
Tell us what have you tried so that we can suggest some new solutions for you...
snehasish nandy at 9-Oct-12 5:44am
   
i tried using like operator..but when i m putting the whole question then it is not working...
Mohd. Mukhtar at 9-Oct-12 5:52am
   
you need to write a function with reqex to do like statement task.
snehasish nandy at 9-Oct-12 5:53am
   
please give me some example how to do this
Kschuler at 9-Oct-12 16:28pm
   
It would help if you would provide a few examples of what you are searching, what you are searching for, and what result you are expecting.
geekbond at 9-Oct-12 7:44am
   
To find a sentence, you can search for punctuations. All sentences end with either a fullstop('.'), a question mark('?') or an exclamation('!'). So, just perform a search usin regex or any other method you can think of.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Write a stored procedure and in that stored procedure write 3 query as below
query1 = SELECT * FROM tableName WHERE cloumnName like RegExpForExactMatch; 
query2 = SELECT * FROM tableName WHERE cloumnName like RegExpForAllMatch; 
query3 = SELECT * FROM tableName WHERE cloumnName like RegExpForAnyMatch; 
And then execute the query with the union;
 
Hope this will help you.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 410
1 Abhinav S 260
2 Nirav Prabtani 252
3 Andreas Gieriet 155
4 Dave Kreskowiak 155
0 OriginalGriff 7,545
1 Sergey Alexandrovich Kryukov 6,757
2 Maciej Los 3,909
3 Peter Leow 3,693
4 CHill60 2,712


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 9 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100