select a.name,b.name from syscolumns  a join systypes  b on a.xtype=b.xtype where a.id=object_id('tablename')

解决方案 »

  1.   

    select a.name,a.length,b.name from syscolumns  a , systypes  b where a.xtype=b.xtype and a.id=object_id('tablename')
      

  2.   

    select * from sysobjects where type='U'
    go
    select a.name,b.name,a.length from syscolumns a,systypes b where
    a.xtype=b.xtype and a.id=object_id('yourtable')
    go
      

  3.   

    循环从sysobjects 中找出表名,再从syscolumns,systypes中找出定义,上面只完成了一张表的处理.
      

  4.   

    定意一个游标,从sysobjects 找出表名,在定意一个游标从syscolumns是找到相关的类型就行了
      

  5.   

    use test01SELECT          TABLE_NAME, COLUMN_NAME, DATA_TYPE
    FROM            INFORMATION_SCHEMA.COLUMNS
    where  DATA_TYPE = 'int' 可以选出一个库里的。
    数据库名和字段类型自己改,另外可能会选出系统表里的,没有仔细测试。
      

  6.   

    use test01SELECT          TABLE_NAME, COLUMN_NAME, DATA_TYPE
    FROM            INFORMATION_SCHEMA.COLUMNS, sysobjects
    where  DATA_TYPE = 'int' 
    and INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = sysobjects.name
    and sysobjects.xtype = 'u'除了表dtproperties,系统表也能滤掉了。
      

  7.   

    我刚才试了一下,这样可以的:
    select  a.name,a.length,b.name from syscolumns a, systypes b,sysobjects c
    where a.xtype=b.xtype and a.id=c.id and c.name='tjxzbbm'
    ,你可以试试。
      

  8.   

    这个问题应该用不着游标。
    select distinct b.name from syscolumns a, systypes b,sysobjects c
    where a.xtype=b.xtype and a.id=c.id and c.type='U'
      

  9.   

    select  distinct data_type
    from    information_schema.columns, sysobjects
    where information_schema.columns.table_name = sysobjects.name
    and sysobjects.type = 'u'
      

  10.   

    information_schema这个东西在那可以看到,都有些什么功能呢?
      

  11.   

    information_schema是什么东西,都有些什么功能呢?能给些资料吗?
      

  12.   

    select c.Name as TableName,b.name as ColName,a.name as Type,a.length from syscolumns a,systypes b,sysobjects c where c.type='U'
    a.xtype=b.xtype and a.id=c.id
      

  13.   

    更正:select c.Name as TableName,b.name as ColName,a.name as Type,a.length 
    from syscolumns a,systypes b,sysobjects 
    c where c.type='U' and
    a.xtype=b.xtype and a.id=c.id
      

  14.   

    select distinct b.name from syscolumns a, systypes b,sysobjects c
    where a.xtype=b.xtype and a.id=c.id and c.type='U'试试,没问题的