Get Table and Field Names
From: Paschalis Pagonidis (anonymous_at_discussions.microsoft.com)
Date: 11/16/04
- Next message: Ken Varn: "Need explanation on calling Close() from finalizer."
- Previous message: resolutionsnet: "Re: ADO works ADO.NET does"
- In reply to: et: "Get Table and Field Names"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 16 Nov 2004 05:58:56 -0800
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.
>
>
>.
>
- Next message: Ken Varn: "Need explanation on calling Close() from finalizer."
- Previous message: resolutionsnet: "Re: ADO works ADO.NET does"
- In reply to: et: "Get Table and Field Names"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|