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
Solved

What sql query can I perform to show me the field names?

Posted on 2011-03-04
4
533 Views
Last Modified: 2012-05-11
I am needing to run a query and get results based the field being equal to a particular value. However, I am not familiar with this database structure and need to view the individual names of the record fields. Is there a technique or query I can run in SQL 2008 that will give me this info?
0
Comment
Question by:jso2765
  • 2
4 Comments
 
LVL 16

Expert Comment

by:santoshmotwani
ID: 35040541
select column_name,* from information_schema.columns
 where table_name = 'YourTableName'
0
 

Author Comment

by:jso2765
ID: 35040556
Where would I find the table name?
0
 
LVL 16

Accepted Solution

by:
santoshmotwani earned 250 total points
ID: 35040573
just do

DESCRIBE ;

or
try this

SELECT column_name,column_type,is_nullable,column_key,col  umn_default,extra FROM information_schema.COLUMNS WHERE
table_schema='' AND table_name=''
0
 
LVL 40

Expert Comment

by:Sharath
ID: 35040593
You should know your database name, table name and column which you want to query.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
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…

828 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