先切到該資料庫下面
Use DBName
然後下這串指令,會把View與Table都顯示出來
SELECT * FROM INFORMATION_SCHEMA.TABLES
如果只要抓取Table
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE (TABLE_TYPE = 'BASE TABLE') AND (TABLE_SCHEMA = 'dbo')
如果只要抓取View
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE (TABLE_TYPE = 'VIEW') AND (TABLE_SCHEMA = 'dbo')