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

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 substring search

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-29 : 09:28:30
krishnan writes "I have a column "description" in my table that holds lengthy strings. I need to retrieve rows with "description" having my search keyword as a substring.
eg: column "description" has a value "i love sql" in one of its rows..when i enter "sql" as my search keyword i should retrieve this particular row.."

OMB
Yak Posting Veteran

88 Posts

Posted - 2002-05-29 : 09:38:18
Try this

declare @mystring varchar(100)

select @mystring = 'sql'

select * from table where fieldname like '%'+ @mystring +'%'

Go to Top of Page
   

- Advertisement -