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
 SQL Server Development (2000)
 Show all tables (names) in the database

Author  Topic 

pippenlam
Starting Member

2 Posts

Posted - 2004-10-12 : 01:56:12
I have searched for lots of forum but couldn't find the answer. So please I want to know the different sql queries to show all the tables in the db, say, MS SQL, Sybase, Informix, IBM DB2.
e.g. In MySQL, there is a sql command: show tables;
But what about the others?

Thanks & regards,
Pippen

pippenlam
Starting Member

2 Posts

Posted - 2004-10-12 : 02:47:16
Should use the sysobjects for MS SQL & Sybase?
if so, is it:
select name from sysobjects where type ='U';
??

Moreover, how about the informix and IBM DB2??

Many thanks,
Pippen
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-10-12 : 03:58:11
There are views in MS-SQL which are supposed to be more standards-compliant - but I dunno if they are available on the other platforms!

SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'

Kristen
Go to Top of Page

hgorijal
Constraint Violating Yak Guru

277 Posts

Posted - 2004-10-12 : 04:55:28
IBM DB2 : SELECT NAME FROM SYSTABLES WHERE TYPE = "T"

Hemanth Gorijala
BI Architect / DBA...
Go to Top of Page
   

- Advertisement -