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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print out list of tables in the database???

Status
Not open for further replies.

qb828

Programmer
Sep 27, 2000
98
US
Hi Guys!

I need to get the names of list of tables in the Sql server database.

Is there a way to print out the table names from the database??
THanks.

QB
 
If you want to manually create the list and paste it into a text or excel file, you can run the following command in Query Analyzer and cut/paste the results.

SELECT name
FROM sysobjects
WHERE (xtype = 'U')
ORDER BY name

If you want to automate the process you may need to create a DTS package where your Source is the DB you want the table names from. Then you Target would be set to an excel worksheet or text file. Then you would use an "Transform Data Task" with the same code as listed above.

Thanks

J. Kusch
 
You can use INFORMATION_SCHEMA.TABLES view also to get the list tables in the database, to which the current usr has permission

SELECT * FROM INFORMATION_SCHEMA.TABLES

Sunil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top