取得資料庫「資料表數」、「資料表名稱」,「資料表內欄位名稱」、「欄位數量」

=====MSSQl=====

1.取得資料庫表單數量
select count(*) as totaltablenumber from sysobjects where xtype = 'U';

2.取得資料表名稱(tablename)及欄位數量(columnnumber)
select name as tablename, info as columnnumber from sysobjects where xtype = 'U';

3.取得某一資料表內所有欄位名稱
select b.name from sysobjects as a, syscolumns as b where a.xtype = 'U' and a.id = b.id and a.name='資料表單名稱';

3.1 取得某一資料表內所有欄位名稱

EXEC sp_columns 表單名稱

=====MySQL=====

1.取得資料庫表單數量

show tables; 之後再加總

2.取得資料表名稱及欄位數量及所有欄位名稱

describe 表單名稱; 之後可取得資料庫欄位名稱及數量

=====MS ACCESS=====

1.取得資料庫表單數量
select count(*) as totaltablenumber from MSysObjects where Type = 1 and Flags = 0;

2.取得資料表名稱

select name as tablename from MSysObjects where Type = 1 and Flags = 0
創作者介紹
創作者 wesley7790的部落格 的頭像
wesley7790

wesley7790的部落格

wesley7790 發表在 痞客邦 留言(0) 人氣( 2204 )