If you are using NHibernate and all classes are well mapped, you would try the following
Code:
System.Collections.IDictionary cm = sessionFactory.GetAllClassMetadata();
foreach (Type type in cm.Keys)
{
NHibernate.Persister.Entity.AbstractEntityPersister persister =
(NHibernate.Persister.Entity.AbstractEntityPersister)cm[type];
string[] properties = persister.PropertyNames;
}
If you are using SQL query, you would try this for SQL Server 2000
Code:
SELECT syscolumns.*
FROM sysobjects INNER JOIN syscolumns ON sysobjects.id = syscolumns.id
WHERE sysobjects.name = 'YourTableName'
ORDER BY syscolumns.colid