Get table column names in sql|Get all columns in perticular sql table.

Method1:
SELECT COLUMN_NAME,* 
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'forum' 
Result:
Method2:
select
syscolumns.name as [ColumnName],
sysobjects.xtype as [Objtype] from 
sysobjects, syscolumns 
where sysobjects.id = syscolumns.id
and   sysobjects.xtype = 'u'
and   sysobjects.name = 'forum'
order by syscolumns.name
Result:

Post a Comment

0 Comments