如何查看表与视图结构,sql语句如下:
--sqlserver
select sysobjects.name as 表名, syscolumns.name as 列名,
systypes.name AS 数据类型, syscolumns.length AS 数据长度
from
sysobjects inner join
syscolumns ON sysobjects.id = syscolumns.id INNER JOIN
systypes ON syscolumns.xtype = systypes.xtype
where (sysobjects.xtype = 'u' or
sysobjects.xtype = 'v') AND (systypes.name <> 'sysname')
--and CONVERT(char,sysproperties.[value]) <> 'null' --导出注释不为'null'的记录
and (sysobjects.name = 'roi_logs') --逐个关联表名,可以用or连接条件
order by 表名
--mysql
desc 表名;
show columns from 表名;
describe 表名;
show create table 表名;
use information_schema
select * from columns where table_name='表名';