有一个information_schema.columns的视图可以做到。information_schema还有多个有用的视图,可以看看帮助。
select * from information_schema.columns where table_name=yourtablename

解决方案 »

  1.   

    这位大哥。我还是没有太懂。我在查询分析里。执行这个语句。
    无法执行啊。它把information_schema.columns当成一个表名!
      

  2.   

    select * from syscolumns where id = object_id(表名)
      

  3.   

    to zhuzhichao(竹之草) (  )我有一个tblFactory表在查询分析器执行。
    select * from syscolumns where id = object_id(tblFactory)服务器: 消息 207,级别 16,状态 3,行 1
    列名 'tblFactory' 无效。
      

  4.   

    大哥,你应该这样用:
    select * from information_schema.columns where table_name='tblFactory'或者:
    select * from syscolumns where id = object_id('tblFactory')