Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

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

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

Posting Yak Master

125 Posts

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

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

Flowing Fount of Yak Knowledge

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'
print 'no'
-- Alternative Method. 
if (CharINdex(@Word,'%a%')>0)
print 'yes'
print 'no'

Go to Top of Page

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...

Ryan Randall 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  
 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.05 seconds. Powered By: Snitz Forums 2000