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)
 WHERE [rowname] IN @variable does not work.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-15 : 01:59:02
Matt Vorne writes "If you use the following query the data comes back just fine:

select * from users where username in ('Bob','Sue','Joe')

but this does not work when you use a @variable

declare @userlist varchar(255)
set @userlist = '''Bob'',''Sue'',''Joe''

select * from users where username in (@userlist)

I've played around with quotes to my hearts content, but I can't get it to work.

How do I solve this problem?

Thanks.

-Matt"
   

- Advertisement -