SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 search a word in a string
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ranjeetsingh_6
Posting Yak Master

India
125 Posts

Posted - 07/19/2006 :  04:06:03  Show Profile  Reply with Quote
Hi

I have a string varchar variable @word and store in it this string "asde adsf afsdrh asjfktg ncdjft jfjgtkg kkglll" and want to search in this string a single word .How i can do it .
Please give me that solution which search a word and Time take minimum for search.


Ranjeet Kumar Singh

chiragkhabaria
Flowing Fount of Yak Knowledge

India
1907 Posts

Posted - 07/19/2006 :  04:26:28  Show Profile  Visit chiragkhabaria's Homepage  Send chiragkhabaria a Yahoo! Message  Reply with Quote
Somthing like this


Declare @Word Varchar

Set @Word = 'asde adsf afsdrh asjfktg ncdjft jfjgtkg kkglll'

if (@Word Like '%a%') 
print 'Yes'
Else 
print 'no'
-- Alternative Method. 
if (CharINdex(@Word,'%a%')>0)
print 'yes'
else 
print 'no'


Chirag
Go to Top of Page

RyanRandall
Flowing Fount of Yak Knowledge

United Kingdom
1074 Posts

Posted - 07/19/2006 :  06:17:29  Show Profile  Reply with Quote
You might also want to look into full text searching functionality...

http://www.sqlteam.com/item.asp?ItemID=114
http://www.databasejournal.com/features/mssql/article.php/3441981


Ryan Randall
www.monsoonmalabar.com London-based IT consultancy

Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000