Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Server $ function
Message
 
À
12/12/2012 10:45:25
Gary Foster
Pointsource Consulting LLC
Chanhassen, Minnesota, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01559422
Message ID:
01559428
Vues:
56
This message has been marked as a message which has helped to the initial question of the thread.
>Hi,
>
>I'm trying to find if a string exists as part of another string like the $ operator in Fox. I'm using this in a CASE statement.
>
>I need to use a variable for the right hand side of the comparison and can't get it to work for the life of me!
>
>Works fine:
>if exists(select 1 where 'anc' in ('anc','add','xxx'))
>
>Fails miserably:
>declare @MyList varchar(20)
>-- Code to build list...
>print @MyList
>displays 'anc','add','xxx'
>
>if exists(select 1 where 'anc' in (@MyList)) -- Fails
>
>Perhaps I'm not building my list string properly?
>
>Thanks.


PATHINDEX() and CHARINDEX(), but I prefer Naomi's example with Temp Table.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform