I have a variable that doesn't work properly, but the query works when I use a string of characters....
DECLARE @nameStr _str varchar(3500)
set @nameStr = 'aaa','bbb','ccc'
this works:
select * from tableA where name in ('aaa','bbb','ccc')
but this does NOT work:
select * from tableA where name in ( @nameStr )
Why does the variable not work?
Thanks in advance.
DECLARE @nameStr _str varchar(3500)
set @nameStr = 'aaa','bbb','ccc'
this works:
select * from tableA where name in ('aaa','bbb','ccc')
but this does NOT work:
select * from tableA where name in ( @nameStr )
Why does the variable not work?
Thanks in advance.