Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 how to return table list in a database

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-08-08 : 09:15:26
swing writes "in SQL query analyzer how to return table list in a database?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-08-08 : 09:15:47
SELECT table_name FROM INFORMATION_SCHEMA.TABLES

Go to Top of Page

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-08-08 : 09:59:36
However that will also return views and system tables which may or may not be what you want.

 
select TABLE_NAME
from INFORMATION_SCHEMA.TABLES
where TABLE_TYPE='BASE TABLE' --Exclude views
and OBJECTPROPERTY(OBJECT_ID(TABLE_NAME),'IsMSShipped')=0 --exclude system tables



HTH
Jasper Smith
Go to Top of Page
   

- Advertisement -