(1)首先獲取當前數據庫中的所有用戶表:
select Name from sysobjects where xtype=''u'' and status>=0
(2)然後獲取某一個表的所有字段
select name from syscolumns where id=object_id(''表名'')
(3)查看與某一個表相關的視圖、存儲過程、函數
select a.* from sysobjects a, syscomments b where a.id = b.id and b.text like ''%表名%''
(4)查看當前數據庫中所有存儲過程
select name as 存儲過程名稱 from sysobjects where xtype=''P''