Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Interesting problem
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01350194
Message ID:
01350555
Vues:
22
>
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform