Link to home
Start Free TrialLog in
Avatar of gogetsome
gogetsomeFlag for United States of America

asked on

Select * column names

Hello, is it possible to select all of the column names for a particular table? If so, how is that accomplished?
ASKER CERTIFIED SOLUTION
Avatar of Ashish Patel
Ashish Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aneesh
better query directly from information_schema.Columns views

SELECT Column_name
from Information_schema.Columns
WHERE Table_Name = 'urTableName'
Your question is not clear
1. If you want the name of columns as output use this
Select * from syscolumns where ID =Object_ID('TableName')

2. if you want data from all the columns use this:
select * from tablename
SELECT dbo.syscolumns.name AS ColName
FROM dbo.syscolumns INNER JOIN
dbo.sysobjects ON dbo.syscolumns.id =
dbo.sysobjects.id
WHERE (dbo.sysobjects.name = 'your table name')