• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1572
  • Last Modified:

sql query to get list of all tables

Any one know how to list all tables in a db using SQL
0
bearware
Asked:
bearware
1 Solution
 
mrorphCommented:
Try:
Select TABLE_NAME,TABLE_TYPE from INFORMATION_SCHEMA.TABLES
0
 
arun04Commented:
which RDBMS are you taking about, this information is present in different data dictionary tables in various RDBMS

for oracle

select * from tab where tabtype = 'TABLE' ;


for sql server and sybase

select name from sysobjects where type = 'U'

0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
if you use ADO, you can use:

dim c as new ADODB.Connection
dim t as adodb.recordset
c.open "yourdatabaseparams"
set t = c.OpenSchema (adSchemaTables)

CHeers
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
mrorphCommented:
arun04:

I tested the statement on SQL server and I believe that it is ANSI 92 SQL and not RDBMS-specific.  I am not sure though.
0
 
MoondancerCommented:
bearware, have you been helped here?  Is this the question you asked me about in the Community Support question?

Experts, is there anything further you can add here to help bearware?

Thanks,
Moondancer - EE Moderator
0
 
bearwareAuthor Commented:
It seems there is no portable way to do this with SQL.
I friend says that ODBC,JDBS, and UDBC provide a portable way.
0
 
nico5038Commented:

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - PAQ'd and pts removed
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 
NetminderCommented:
Per recommendation, points NOT refunded and question closed.

Netminder
CS Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now