all groups > sql server (alternate) > march 2004 >
You're in the

sql server (alternate)

group:

Retrieving table column names via SQL?


Re: Retrieving table column names via SQL? Chuck Conover
3/30/2004 10:15:36 AM
sql server (alternate): 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



[quoted text, click to view]

Retrieving table column names via SQL? M Wells
3/30/2004 5:03:41 PM
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,

Re: Retrieving table column names via SQL? John Gilson
3/30/2004 5:07:14 PM
[quoted text, click to view]

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

AddThis Social Bookmark Button