select distinct '姓名' as t1,     '性别' as t2    , '年龄' as t3
from table1
union
select xingming as t1,convert(varchar(2),xingbie) as t2 , convert(int,nianling) as t3 from table1

解决方案 »

  1.   

    SELECT 
    表名=d.name,
    字段序号=a.colorder,
    字段名=a.name,
    字段说明=isnull(g.[value],'')
    FROM syscolumns a
    inner join sysobjects d on a.id=d.id  and d.xtype='U' and  d.name<>'dtproperties'
    left join sysproperties g on a.id=g.id and a.colid=g.smallid  
    --where d.name='要查询的表'    --如果只查询指定表,加上此条件
    order by a.id,a.colorder
    --列出表"user_base"中列163car_163bbs的描述属性:
    SELECT value
    FROM ::fn_listextendedproperty('MS_Description','user','dbo','table','user_base','column','163car_163bbs')--用存储过程sp_columns 表名
      

  2.   

    exec sp_addextendedproperty N'MS_Description', N'字段描述', N'user', N'dbo', N'table', N'表名', N'column', N'列名'
      

  3.   

    SELECT 
    表名=d.name,
    字段序号=a.colorder,
    字段名=a.name,
    字段说明=isnull(g.[value],'')
    FROM syscolumns a
    inner join sysobjects d on a.id=d.id  and d.xtype='U' and  d.name<>'dtproperties'
    left join sysproperties g on a.id=g.id and a.colid=g.smallid  
    --where d.name='要查询的表'    --如果只查询指定表,加上此条件
    order by a.id,a.colorder
    --列出表"user_base"中列163car_163bbs的描述属性:
    SELECT value
    FROM ::fn_listextendedproperty('MS_Description','user','dbo','table','user_base','column','163car_163bbs')