Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now