我们用select * from table 可以检索出所有的
用select a,b,c可以检索出字段a,b,c来
相反我想得到不包含a,b,c字段以外的所有字段怎么办呢?
请高手回答,马上结贴~

解决方案 »

  1.   

    请xeqtr1982(ShaKa)接此分 谢谢
      

  2.   

    这个是你应得的 我是从.net移过来的帖子,那边没有人回答
    这个问题是你解决的 到分就不这样了
      

  3.   

    我想把查出来的放到dataset里面,通过ds.tables["table"].row[0][i]这样取列值,可是这样杂乱无章,不按照原来的顺序我就没有办法识别那个是我要提取的列,您还能帮帮忙吗?谢谢
      

  4.   

    jwt1982(飞星)
    http://community.csdn.net/Expert/topic/4629/4629096.xml?temp=.3574793
      

  5.   

    declare @str varchar(100)
    set @str=''select @str=@str+','+a.[name] from syscolumns a,sysobjects b where a.id=b.id and b.id=object_id('表名') and a.name not in('列名','列名') order by a.colid
    set @str=stuff(@str,1,1,'')
    select @strexec('select '+@str+' from 表名')
    --这样呢?
      

  6.   

    declare @str varchar(100)
    set @str=''select @str=@str+','+a.[name] from syscolumns a,sysobjects b where a.id=b.id and b.id=object_id('表名') and a.name not in('列名','列名') order by a.colid
    set @str=stuff(@str,1,1,'')
    select @strexec('select '+@str+' from 表名')
    --这样呢?
      

  7.   

    ds.tables["table"].row[0][i]
    没必要按顺序ds.tables["table"].row[0]["列名"]
      

  8.   

    不行
    缺了几列 哪出问题了呢??
    我执行这些
    declare @str varchar(100)
    set @str=''select @str=@str+','+a.[name] from syscolumns a,sysobjects b where a.id=b.id and b.id=object_id('表名') and a.name not in('列名','列名') order by a.colid
    set @str=stuff(@str,1,1,'')
    select @str
    出现了语句顺序正常正常,可是一个字段名缺了个字母,我的字段名叫GRNS 可是最后查出来这个字符串str是GRN 以后的字段就查不出来了
      

  9.   

    declare @str varchar(1000)
    set @str=''select @str=@str+','+a.[name] from syscolumns a,sysobjects b where a.id=b.id and b.id=object_id('表名') and a.name not in('列名','列名') order by a.colid
    set @str=stuff(@str,1,1,'')
    select @strexec('select '+@str+' from 表名')
    --把@str的变量的长度加长呢?
      

  10.   

    tntzbzc()
    ds.tables["table"].row[0][i]
    没必要按顺序ds.tables["table"].row[0]["列名"]
    我的是一个for循环取的列
    比如
    for(int i=0;i<5;i++)
    {
      ds.tables["table"].row[0][i]
    }
    我是这样动态读取的,如果没有这个顺序我的就没有办法去对应了
      

  11.   

    declare @str varchar(8000)
    --不够长的话就改成8000
      

  12.   

    可以了
    太感谢xeqtr1982(ShaKa)了
    我要结贴了