Hi, I have a problem on using dynamic SQL in MsSQL Server 2000 to Crystal Report(which is in sp execute itself is no problem). The problem i facing as below:

create proc sp_Test
@Condition nvarchar(2000)
as

declare
@TmpStr nvarchar(4000)

set @TmpStr = 'Select f1,f2 from table1 where f1 in (' + @Condition + ')'

execute sp_executesql @TmpStr

if this statement we run in store procedure by exec sp_test '111' --> Assume 111 is a condition value,
it is ok and can return value to me, but now if i try to use Crystal Report to call the sp (At Design mode of Crystal Report), it will return error
" unclose quotation marks before the character String ')' "

May i know why?
If i try to use

create proc sp_Test
@Condition nvarchar(2000)
as

declare
@TmpStr nvarchar(4000),
@Param nvarchar(200)

set @TmpStr = 'Select f1,f2 from table1 where f1 in (@Cond)'

Set @param= '@Cond nvarchar(2000)'
execute sp_executesql @TmpStr,@Param,@Condition

it not return any error, but when execute it, it won't give me correct answer, which is when i try to run it, it assume the value is 1 whole string , rather then seperate to several value example:

I want is

Select f1,f2 from table1 where f1 in ('2333','333')

it given to me is

Select f1,f2 from table1 where f1 in ('2333,333')

Hope can hear from you as soon as possible.

Thanks you.