363,924 Members | 2595 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

How to get table list from a db? Thanks!

rong.guo@gmail.com
P: n/a
rong.guo@gmail.com
Hi Group!

I would like to get a list of all the table names from a database, can
anybody please tell me how to do that? Many thanks!

Aug 2 '05 #1
Share this Question
Share on Google+
4 Replies


Simon Hayes
P: n/a
Simon Hayes
See sp_tables and sysobjects in Books Online.

Simon

Aug 2 '05 #2

Madhivanan
P: n/a
Madhivanan

Select table_name from information_schema.tables
where table_type='Base table' order by table_name

Madhivanan

Aug 2 '05 #3

Chandra
P: n/a
Chandra

Hi, you can write it as:

SELECT name [Table Name]
FROM sysobjects
WHERE xtype = 'U'

Please let me know if this helped

best Regards,
Chandra
http://www.SQLResource.com/
http://chanduas.blogspot.com/
---------------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Aug 4 '05 #4

Madhivanan
P: n/a
Madhivanan
Chandra, It is better to use views and avoid using system tables

Madhivanan

Aug 4 '05 #5

Post your reply

Help answer this question



Didn't find the answer to your Microsoft SQL Server question?

You can also browse similar questions: Microsoft SQL Server