--sql Server 2005, or 2012:select * from Information_schema.tables--sql server 2000:select * from sysobjects WHERE xt ype= ' u ' select * from sysobjects WHERE xtype= ' u ' select table_name from GEOVIDNU. Information_schema. Tablesselect sobjects.namefrom sysobjects sobjectswhere sobjects.xtype = ' U ' EXEC sp_spaceused ' yourtablename '-- The column names of all watches are shown in select Column_name,table_name from Geovidnu. Information_schema. Columnsselect * from Geovidnu. Information_schema. Columnsselect c.name ' Column name ', t.name ' Data type ', c.max_length ' max length ', C.precision, C.scale, C.is_nullable, ISNULL (i.is_primary_key, 0) ' primary key ' from sys.columns Cinner JOIN sys.types t on c.us er_type_id = t.user_type_idleft OUTER JOIN sys.index_columns ic on ic.object_id = c.object_id and ic.column_id = C.col Umn_idleft OUTER JOIN sys.indexes i on ic.object_id = i.object_id and ic.index_id = i.index_idwhere c.object_id = O bject_id (' Yourtablename ')--http://stackoverflow.com/questiOns/2418527/sql-server-query-to-get-the-list-of-columns-in-a-table-along-with-data-types-noselect COLUMN_NAME, Data_type, Character_maximum_length, Numeric_precision, Datetime_precision, is_nullable from INFORMATION_SCH EMA. Columnswhere table_name= ' yourtablename ' Select c.column_name, C.data_type, C.character_maximum_length, C.NUMERIC_ PRECISION, C.is_nullable, TC. Constraint_namefrom information_schema. COLUMNS as C left Join information_schema. Table_constraints as TC on TC. Table_schema = C.table_schema and TC. table_name = C.table_name and TC. Constraint_type = ' PRIMARY KEY ' Where c.table_name = ' yourtablename '----http://sqlserver2000.databases.aspfaq.com/ How-do-i-get-a-list-of-sql-server-tables-and-their-row-counts.html
SQL Server query to get the list of column name in a table