Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Interesting problem
Message
 
 
To
25/09/2008 10:06:24
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01350194
Message ID:
01350555
Views:
21
>
>DECLARE @lcParameter varchar(max)
>SET @lcParameter = 'IN, OUT, CONTAINS, SOMETHING'
>
>SELECT YourTable.*
>FROM YourTable
>INNER JOIN dbo.Split(@lcParameter) TmpSplit ON YourTable.SomeField LIKE '%'+TmpSplit.TheField+'%'
>
>That could return multiple records if more than one key word is presented in the field but you could use DISTINCT.
>I thing Sergey has Split function defined on his site.

You're missing the point.

AND OR CONTAINS is the Operator. And we're passing list of keywords.

So, if we passed AND operator, it would mean

SELECT YourTable.*
FROM YourTable
INNER JOIN dbo.ufn_alines(@Keywords) TmpSplit ON YourTable.SomeField =TmpSplit.Item

Similar for CONTAIN.

However, for OR operator there is no way.

Here is a link to Sergey's function (I recommend it at .NET forum all the time).

Split
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform