Wednesday, March 21, 2012

How to get table list from a db? Thanks!

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!See sp_tables and sysobjects in Books Online.

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

Madhivanan|||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 ***|||Chandra, It is better to use views and avoid using system tables

Madhivanan

No comments:

Post a Comment