Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Retrieving table column names via SQL?

0 views
Skip to first unread message

M Wells

unread,
Mar 30, 2004, 12:03:41 PM3/30/04
to
Hi All,

Just wondering if it's possible to retrieve a table's column names via
SQL in SQL Server 2000?

Any help appreciated!

Much warmth,

Murray

John Gilson

unread,
Mar 30, 2004, 12:07:14 PM3/30/04
to
"M Wells" <planet...@planetthoughtful.org> wrote in message
news:q1aj60hocaams9er1...@4ax.com...

Query INFORMATION_SCHEMA.COLUMNS in the relevant database, e.g.,

USE Northwind

SELECT TABLE_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Products'

--
JAG


Chuck Conover

unread,
Mar 30, 2004, 12:15:36 PM3/30/04
to
Murry,
Sure.
select c.name from syscolumns c
inner join sysobjects o
on c.id = o.id
where o.name = '<your table name>'

PS: Thanks for the warmth, but it's already in the 90s here in Arizona, USA
PPS: You might want to check out our SQL Server 2000 video set. Expert
help, tips, tricks and advice for less than the cost a tech book.

Best regards,
Chuck Conover
www.TechnicalVideos.net

"M Wells" <planet...@planetthoughtful.org> wrote in message
news:q1aj60hocaams9er1...@4ax.com...

0 new messages