Try to look at the tables sys.objectsand sys.columns:
SELECT * FROM SYS.OBJECTS
WHERE TYPE = 'U'
Would give you all the tables in this database (Type U)
SELECT 'Table name : ' + so.name, ' Column Name: ' + sc.name FROM SYS.OBJECTS so
INNER JOIN sys.columns sc ON sc.OBJECT_ID = so.OBJECT_ID
WHERE TYPE = 'U'
Gives you all the tables in this database and column names. You can filter these queries and doWHERE so.name = 'Your Table'
http://msdn.microsoft.com/en-us/library/ms190324.aspx
source
share