sql server获取所有表名、字段名、字段类型、表行数(转载)
获取所有的表名------
①select name from sysobjects where xtype='u';
②select name from sys.tables;
③select table_name from information_schema.tables;
获取所有字段名-----
①select name from syscolumns where id=object_id('表名');
②select column_name from information_schema.columns where table_name = '表名';
获取表的字段以及字段类型------
select table_name,column_name,data_type
from information_schema.columns
where table_name = '表名';
获取行数量-------
select rows from sysindexes where id = object_id('表名');