Solved

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

Posted on 2011-03-04
4
524 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MSSQL Speen Degradation 4 21
form builder not starting 3 34
Query Syntax 17 32
While in ##Table - Help 4 12
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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…

786 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