Information Schema views in SQL Server 2005

I keep forgetting the exact syntax for this and have to do some hit-and-miss with Books On-Line.

SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = ‘dbo’ AND TABLE_NAME = ‘Employee’ ORDER BY ORDINAL_POSITION

See the MSDN article for more information. It is generally easier using these views than mucking about with sysobjects, syscomments etc.

Comments