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)
 Split String to search using Stored Proc

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-04-25 : 19:07:40
Ray writes "How can you split a string to perform a search in a stored proc?
Eg. "Hello Man" so that we can do a search such as such that

= field like '%hello%' and field like '%man%'
I tried using

set @l = rTrim(LEFT(@item,CHARINDEX(' ',@item)))
set @r = lTrim(RIGHT(@item,CHARINDEX(' ',@item)))

= field like '%' + @l + '%' and field like '%' + @r + '%'

to search based o those but that didnt work. Any ideas?"
   

- Advertisement -