select a.name 表名 from sysobjects a,syscolumns b where b.name = 'cProBatch' and a.id=b.id

解决方案 »

  1.   

    select object_name(id) as 所在的表
    from syscolumns  a
    where exists(
      select 1 from syscolumns where id=a.id and name='cProBatch')
      

  2.   

    楼上的方法都试过,按前两位楼客的方法是查询的所有的表,也包括视图,但是我只想让它返回表,不要视图。
        我在pbsql(风云)兄的基础上做了改动,所以返回的结果是正确的。
    select a.name 表名 from sysobjects a,syscolumns b where b.name = 'cProBatch' and a.id=b.id and a.xtype='u'To zjcxc(: 邹建 :) 兄:
          .....select 1 from syscolumns.....中的1是什么意思,小弟想从您那多点,      嘿嘿!:)
      

  3.   

    select a.name as 表名 from (sysobjects a inner join syscolumns b on a.id=b.id)
    where a.xtype='u'and b.name = 'cProBatch'
      

  4.   

    select  a.name as 所在的表  from sysobjects a,syscolumns b where a.id=b.id and b.name='cProBatch'  and a.xtype='U'