1. 程式人生 > >SQLServer:獲取表名,列名等資訊

SQLServer:獲取表名,列名等資訊

1 根據資料庫名獲取所有表名

  select name from sysobjects where xtype='u'

2 根據表名獲取所有列名

  select name from syscolumns where id = object_id('HIS_OperationList');


3 根據表名 獲取列數 

 select count(name) from syscolumns where id = object_id('HIS_OperationList');