faqts : Computers : Databases : Microsoft SQL Server

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

18 of 30 people (60%) answered Yes
Recently 8 of 10 people (80%) answered Yes


how to query, listing of all tables in a database

Nov 11th, 2006 11:35
Matt Chatterley, naseem uddeen,

Try this:
USE <database_name_here>
SELECT * FROM SysObjects WHERE OBJECTPROPERTY(id, 'IsUserTable') = 1
.. should work on SQL 2000 / 2005.
You can also query on "XType = 'U'", but use of OBJECTPROPERTY is
preferred, as the xtype field may change in the future.