select name from syscolumns where xtype=36 and id=object_id('表名')
go

解决方案 »

  1.   

    or:
    select a.name from syscolumns join systypes b on a.xtype=b.xtype 
    where b.name='uniqueidentifier' and a.id=object_id('表名')
      

  2.   

    select a.name from syscolumns a join systypes b on a.xtype=b.xusertype where b.name='uniqueidentifier' and a.id=object_id('表名')
      

  3.   

    以上的方法是否限于GUID字段的类型是uniqueidentifier的,若设置的是VARCHAR呢?
      

  4.   

    select a.name from syscolumns a join systypes b on a.xtype=b.xusertype where b.name='uniqueidentifier' and a.id=object_id('表名')
    以上的方法是否限于GUID字段的类型是uniqueidentifier的,若设置的是VARCHAR呢?
    就改成:select a.name from syscolumns a join systypes b on a.xtype=b.xusertype where b.name='VARCHAR' and a.id=object_id('表名')不管你是想查询什么的。只要把b.name='你要查询的类型'select a.name from syscolumns a join systypes b on a.xtype=b.xusertype where b.name='你要查询的类型' and a.id=object_id('表名')
      

  5.   

    select a.name from syscolumns a join systypes b on a.xtype=b.xusertype where b.name='VARCHAR' and a.id=object_id('表名')
    如果写成上面那样,其不是把表中所有的VARCHAR类型的字段都找到了?可我要的是内容是GUID的啊?