首页 > 代码库 > 查询所有数据库,数据集

查询所有数据库,数据集

use master ;
查询数据库:
select * from sysdatabases where dbid>4 ;
查询表:
SELECT * FROM SysObjects Where XType=U ORDER BY Name
查询列:
select b.name as tableName,a.name as columnName,c.name as columnType,a.length as columnLength from syscolumns a inner join sysobjects b on a.id=b.id inner join systypes c on a.xtype=c.xtype WHERE a.id=OBJECT_ID(N[表名]) And c.name not like sysname ORDER BY colid