Brian Cryer

 
 

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.