Retrieve Column name in SQL

Posted on 2003-03-07
Medium Priority
Last Modified: 2010-08-05
Dear Experts,
   I have a database and I don't know what the column names are.  Using SQL in Excel 97, what command(s) do I use to retrieve the name of Column 1 or Column 5?  Also, what command(s) do I use to retrienve the number of columns exist in a database?  Thanks in advance for your help.
   - Charles
Question by:charlesn
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

-Yoshi- earned 150 total points
ID: 8091569
try the query:

DESCRIBE tblname

Expert Comment

ID: 8094189
If your using Oracle use the describe command
desc[ribe] tableName

If you are using u can use sp_help stored procedure


sp_help table_name

Author Comment

ID: 8120287
Thanks for your suggestion; however it didn't work.  Instead a colleague suggested that I try this (which worked):
SELECT * FROM AnyDatabase

Thanks, again.

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question