这样写
declare @Param as varchar(255) (输入参数)
declare @InSQL as varchar(255) set @Param='AAA,BBB,CCC'
set @InSQL = ''''+REPLACE(@Param,',',''',''')+'''' set @InSQL = 'select f1,f2 from T where T.Code in ( '+@InSQL+')'conn.execute(@InSQL)
declare @Param as varchar(255) (输入参数)
declare @InSQL as varchar(255) set @Param='AAA,BBB,CCC'
set @InSQL = ''''+REPLACE(@Param,',',''',''')+'''' set @InSQL = 'select f1,f2 from T where T.Code in ( '+@InSQL+')'conn.execute(@InSQL)
declare @InSQL as varchar(255)
set @Param='AAA,BBB,CCC'
set @InSQL = ''''+REPLACE(@Param,',',''',''')+'''' declare @sql as varchar(255)
set @sql='
select f1,f2
from T
where T.Code in ' + @InSQLexec(@sql)