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
原文地址:http://www.cnblogs.com/xyzhuzhou/p/3858219.html