Can any one tell me that how to get names of all tables of a database using asp.net
+1
A:
You didn't mention which database engine you are using. On SQL Server, you can query the sysobjects
table and filter for objects with type U
:
SELECT name FROM sysobjects WHERE type = 'U'
Mehrdad Afshari
2009-09-12 07:40:09
+3
A:
A newer method on SQL Server is to use the INFORMATION_SCHEMA Views to get the information:
SELECT table_name FROM INFORMATION_SCHEMA.Tables WHERE table_type='BASE TABLE'
This particular view also includes Views in its list of tables, which is why you need the where clause.
patmortech
2009-09-12 08:34:05
+1. This is a better and more portable method than mine, although it's a little longer.
Mehrdad Afshari
2009-09-12 09:46:44
A:
In case you are interested in the MySQL way to achieve this, you can use
DESCRIBE tableName;
Davide Gualano
2009-09-12 21:48:12