--查詢所有數據庫 USE master go select [name] from [sysdatabases] order by [name]

--查詢其中一個數據庫test,就可以得到這個數據庫中的所有的表名了,語句如下:
USE test go
select [id], [name] from [sysobjects] where [type] = 'u' order by [name]

--查出v_lyb這個表中所有的字段 select [name] from [syscolumns] where [id] = 21575115 order by [colid]
--得到該表中的記錄條數前提這個表中要建立索引 select [o].[id], [o].[name], [i].[rows] from [sysindexes] [i], [sysobjects] [o] where [i].[first]>0 and [o].[id]=[i].[id] and [o].[type]='u' and [o].[id]=21575115


