SQL Server Code,Tips and Tricks, Performance Tuning
A blog about SQL Server, Books, Movies and life in general
Thursday, October 06, 2005
How to find all the tables and views in a database
Use the code below
USE
PUBS
GO
--Get All Tables
SELECT
*
FROM
INFORMATION_SCHEMA.TABLES
WHERE
TABLE_TYPE =
'BASE TABLE'
GO
--Get All Views
SELECT
*
FROM
INFORMATION_SCHEMA.TABLES
WHERE
TABLE_TYPE =
'VIEW'
GO
That's all, plain and simple
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment