SQL·高級查詢

--查看所有的數據庫信息;
select * from master..sysdatabases
exec sp_helpdb

--查看某數據庫中的所有用戶表;
select name from northwind..sysobjects where xtype='u'


--查詢某表中所有列名;
select name from syscolumns where id=object_id('news')

--查看某觸發器SQL腳本代碼;

select text from syscomments where id=object_id('NS')

exec sp_helptext 'NS'

--查看某數據庫的具體情況;
select * from sysfiles
exec sp_spaceused
exec sp_helpdb 'NewsSystem'

--查看某表的完整結構;
exec sp_help 'news'

exec sp_msforeachtable

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章