输出表字段明细及输出全连接多表数据

来源:互联网 发布:北京交通大学网络教育 编辑:程序博客网 时间:2024/06/05 21:58

--根据表名获取各个字段的类型、大小等信息

select a.name colname,b.name typename,a.length Length,a.isnullable is_null

from syscolumns a,systypes b

where a.xusertype=b.xusertype and a.id=object_id('表名')

 

--输出全连接的多表数据

select * from (

select * from a

union all

select * from b

) as k

注:必须添加as * ,不然会报错,相当于从视图中查找