Cry How to...

List all tables


To get a list of all the tables in a SQL Server database, use either:

sp_tables

or alternately to list only the user tables use:

select name as TABLE_NAME, user_name(uid) as TABLE_OWNER from sysobjects where type='U'


These notes have been tested against SQL Server 7, SQL Server 2000, SQL Server 2005 and SQL Server 2008.



About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.