Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying col names from a table

Status
Not open for further replies.

it2hill

IS-IT--Management
Sep 5, 2002
28
US
Is there a way to display the col names of a table?

I know you can do a select * and limit with a where that is false like

select *
from my_table
where 1 > 2

Is there a sp or anything that would show the information?

Thanks,

Shane
 
Try this,

select name from syscolumns where id = object_id("my_table") order by colid
RajD
 
There's another (AFAIK, undocumented) function that you can use if you're wanting to have the information in the form of column headings and associated metadata (e.g. to use a java.sql.ResultSetMetaData object):

set fmtonly on
/* returns only the "format" information; no data */
select * from table_in_question
set fmtonly off

HTH,

JMC J M Craig
Alpha-G Consulting, LLC
nsjmcraig@netscape.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top