Looking for some help on a issue that's bugging me hardy.
I am trying to create a subquery with values created from text string. ie..
=======================================
declare @templist varchar(100) -- temp var of text strng
SELECT @templist = '''' + REPLACE('100,101,102,103',',',''',''') + ''''
-- create text string of 100,101,102,103
select @templist --- display just for ha hahs
-- now i am trying to select from a salesmen table
-- only those entries coded with one of the values
-- from the text string ... -- so i attempt to
-- setup the IN clause so that it has '101','102',...
-- in it, instead of just 101,102 ... which wont work
select salesperson_code
from salesmantable
where salesperson_code in ('''' + REPLACE('100,101,102,103',',',''',''') + '''' )
-- unfortunately this returns a blank set
-- it appears that the IN () clause is not
-- evaluating properly
-- why i am doing this is becuase the text string
-- is stored somewhere and used else where ... such that
-- the quotation marks must not be there
can you help me determine or hint where I can find
how to get the statemnt to evaluate properl.y
thank yo u
I am trying to create a subquery with values created from text string. ie..
=======================================
declare @templist varchar(100) -- temp var of text strng
SELECT @templist = '''' + REPLACE('100,101,102,103',',',''',''') + ''''
-- create text string of 100,101,102,103
select @templist --- display just for ha hahs
-- now i am trying to select from a salesmen table
-- only those entries coded with one of the values
-- from the text string ... -- so i attempt to
-- setup the IN clause so that it has '101','102',...
-- in it, instead of just 101,102 ... which wont work
select salesperson_code
from salesmantable
where salesperson_code in ('''' + REPLACE('100,101,102,103',',',''',''') + '''' )
-- unfortunately this returns a blank set
-- it appears that the IN () clause is not
-- evaluating properly
-- why i am doing this is becuase the text string
-- is stored somewhere and used else where ... such that
-- the quotation marks must not be there
can you help me determine or hint where I can find
how to get the statemnt to evaluate properl.y
thank yo u