November 21, 2006 at 6:39 am
sp_executesql [@stmt =] stmt
[
{, [@params =] N'@parameter_name data_type [,...n]' }
{, [@param1 =] 'value1' [,...n] }
]
For example:
Scenario1
sp_execute 'select * from table1 where field1 in (N '123', N'234')'
Scenario2
sp_executesql 'select * from table1 where field1 in (@param1)',
N '@param1 integer',
@param1 = N'123',N'234'
Any ideas - is this possible, are we doing is wrong?
TIA
KT
November 22, 2006 at 2:04 am
perhaps you should be passing a string...
In similar cases I have been driven to writing this in a stored procedure:
where (charindex(',' + field1+ ',',',' + @param + ',')>0
December 13, 2006 at 7:49 am
Hi Jon
Sorry for the delayed response, but thanks for the suggestion this works!
Thanks again
KT
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply