Get Table and Field Names by Paschalis
Paschalis
Tue Nov 16 07:58:56 CST 2004
You can also get table and field names using a stored
procedure.
To get a list of available tables in current database,
execute the following command:
EXEC sp_msforeachtable @command1='print ''?'''
or
EXEC sp_msforeachtable @command1='print REPLACE(REPLACE
(''?'', ''[dbo].['', ''''), '']'', '''')'
Additionally, to retrieve information about extended field
properties (like descriptions) for a table, execute the
following statement:
select * from ::fn_listextendedproperty
(null, 'user', 'dbo', 'table', '<table_name>', 'column',
default)
where <table_name> is the table name.
>-----Original Message-----
>How do I get the names of the tables in a database via
ado.net? Once I have
>the table names, how do I get the names of the Fields for
each table? I
>used to use OpenSchema in vb6 but do not find a
correlating command for
>..net. Thanks.
>
>
>.
>