R
RP
I want to retrieve column names (Exact field names) of a table. How to
do that?
do that?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Depends on the DBMS (if those are the "column"s and "table"s you areRP said:I want to retrieve column names (Exact field names) of a table. How to
do that?
I am using SQL Server 2005. Can it be retrieved using SQL?
The "safest" way to get metatdata from SQL Server like table list and
column lists is to use one of the INFORMATION_SCHEMA Views. For a list
of tables in the current database:
select * from information_schema.tables
Nicholas said:That depends completely on the underlying data source. For SQL Server
2000 and below, you can use the syscolumns table. For SQL Server 2005,
sys.columns is recommended. If you are using another database system, then
that will have its own way of retreiving this info.
You can create a connection and then call the GetSchema method on it.
However, the way that the schemas are defined and what they return are
provider-specific, so you will need to have some knowledge beforehand.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.