|
|
8000XXXX Errors ASP.NET 2.0 Classic ASP 1.0 Databases Access DB & ADO General SQL Server & Access Articles MySQL Other Articles Schema Tutorials Sql Server 2000 Sql Server 2005 General Concepts Search Engine Optimization (SEO)Search | ASP FAQ Tutorials :: Databases :: Schema Tutorials :: Schema: How do I show the tables in a database? Schema: How do I show the tables in a database?There are several ways to retrieve table names from a database. Here is code that uses ADOX. This was tested with MDAC 2.5, and will work with either MS Access or SQL Server.
And here is the code that uses a system stored procedure (note that <uid> needs to have at least 'datareader' access to <dbname>).
For SQL Server, if you have access to Query Analyzer (and just want a table list, not necessarily for code), you can simply type the following and hit F5:
If you want to include views, you can do this:
For more information on retrieving view information specifically, see Article #2526. And finally, for Access, you can run this query:
Related Articles Schema: How do I list all the indexes in a database? Schema: How do I list the databases on my server? Schema: How do I show all the primary keys in a database? Schema: How do I show all the triggers in a database? Schema: How do I show the columns for a table? Schema: How do I show the description property of a column? Schema: How do I show the parameters for a function or stored procedure? Schema: How do I show the stored procedures in a database? Schema: How do I show the user-defined functions (UDFs) in a database? Schema: How do I show the views in a SQL Server database? |