Home > Archive > Microsoft SQL Server forum > August 2005 > How to get table list from a db? Thanks!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to get table list from a db? Thanks!
rong.guo@gmail.com

2005-08-02, 9:23 am

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!

Simon Hayes

2005-08-02, 9:23 am

See sp_tables and sysobjects in Books Online.

Simon

Madhivanan

2005-08-02, 9:23 am


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

Madhivanan

Chandra

2005-08-04, 7:24 am


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.droptable.com ***
Madhivanan

2005-08-04, 9:24 am

Chandra, It is better to use views and avoid using system tables

Madhivanan

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com