Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

view all tables 1

Status
Not open for further replies.

camy123

Programmer
Mar 5, 2004
171
GB
hi quick question whats the sp to display all tables in the database

i normally type

use database
sp_help

but thisshows all objects any idea.

or is there a table in the master database i can query.

 
To see all user tables in a database, use the following within the database you want the information for:

Code:
select *
from sysobjects
where type='U'
 
Be carefull using system tables. They can change from version to version of SQL Server. When quering the system tables you should use the INFORMATION_SCHEMA views instead. These are not supose to change from version to version, and 90% of data you will want from the system tables is available throught these views.
Code:
select  * 
from information_schema.tables 
where table_type = 'BASE TABLE'

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top