Jump to content

How to return a table's column names?


yeago

Recommended Posts

  • 1 month later...
  • 1 month later...
Continuing with GeoffOs post, I find it helpful to include the database name in the FROM clause.

just do a select on the information_schema.COLUMNS table:

select column_name
from <dbname>.information_schema.columns
where table_name = '<tablename>'

see: [a href=\"http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ia-iz_4pbn.asp\" target=\"_blank\"]http://msdn.microsoft.com/library/default...._ia-iz_4pbn.asp[/a]

Cheers!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.