Information générale
Forum:
Microsoft SQL Server
Titre:
SQL Server $ function
Versions des environnements
SQL Server:
SQL Server 2008
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.
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement