返回所有用户数据库 |
select * from master..sysdatabases D where sid not in(select sid from
master..syslogins where name='sa') 或者 select dbid, name AS DB_NAME from master..sysdatabases where sid <> 0x01 |
返回当前库所有用户表 | select Name from sysobjects where xtype='u' and status>=0 |
返回表的所有字段和类型 |
select column_name,data_type from information_schema.columns where table_name = '表名' order by ordinal_position |
所有当前库的存储过程 | select name as 存储过程名称 from sysobjects where xtype='P' |
返回相关的视图、存储过程、函数 | select a.* from sysobjects a, syscomments b where a.id = b.id and b.text like '%表名%' |