select * from aaa where dd in ('''+xxx+''');
xxx='01,02,03,....'

解决方案 »

  1.   

    楼主可以先去试验一下就知道了不过据我所知 in后面应该是一个数据集才行吧 偶SQL很菜的哈。
      

  2.   

    select * from aaa where dd in (select '01','02','03',....)
      

  3.   

    如果dd是整型的话:
    xxx:='01,02,03'
    sql :='select * from aaa where dd in ('+xxx+')';这样执行的时候就会转换成sql='select * from aaa where dd in (01,02,03)';
      

  4.   

    select * from aaa where dd in (select '+xxx+')'
      

  5.   

    xxx:='''01'',''02'',''03''';
    sql:=select * from aaa where dd in ('''+xxx+''')';
      

  6.   

    xxx:='''01'',''02'',''03''';
    sql:='select * from aaa where dd in ('+xxx+')';
      

  7.   

    xxx:=''01','02','03,'';
    select * from aaa where dd in (xxx);
      

  8.   

    明显错了,加了引号就成了常量了,sql:='select * from aaa where dd in ';
    sql:=sql+''01','02','03',...'
      

  9.   

    xxx:='''01'',''02'',''03''';
    sql:='select * from aaa where dd in ('+xxx+')';