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!

List of tables via query

Status
Not open for further replies.

Durandal66

Programmer
Oct 3, 2003
17
US
I was wondering if there was a way to generate a list of all the tables in a database by using an SQL Query. I have found methods of doing this with Java using their libraries, but I would much rather do it using straight SQL. If this is not possible, perhaps there is a way using C#? Thanks in advance!

-Andrew R.
 
I guess I should have mentioned that im using MSSQL. Sadly, the show statement isnt recognized. Any other ideas?

-Andrew R.
 
I give up, shoot me down but ... what about asking on a Microsoft forum
 
Thanks for the effort, I have been smashing my head on a wall over this one for awhile too.

-Andrew R.
 
I found that sending the command "sp_help" does the trick nicely. This returns all views, system tables, user tables, stored procedures, primary key constraints, and the default constraint. This data is presented in three columns, Name, Owner and Object_Type. I built a data reader (C#) that stored only the rows that were user tables (stuff I created), and used it in my application. Not the most elegant way, but the data this call returns will come in handy later in my application, so all is well. Thank you for your help!

-Andrew R.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top