SQL獲得資料庫中表與字段資訊

2021-04-19 18:17:31 字數 310 閱讀 7443

select table_name from information_schema.tables order by table_name

select column_name,ordinal_position,data_type,character_maximum_length from information_schema.columns where table_name = 『tb_name』

select column_name from information_schema.key_column_usage where table_name = 'tb_name'

ADO如何取得資料庫中表的字段資訊

若要取得資料庫中表的字段資訊,由以下recordset物件的屬性可得知 actualsize屬性 欄位的實際大小。definedsize屬性 定義欄位的大小。type屬性 字段型別,使用以下數字代表之 文字text 200 日期時間date 135 整數int 識別碼 3 單精準度 4 雙精準度 5...

JDBC 獲得資料庫生成的主鍵

待整理 10.獲得資料庫生成的主鍵 1.操作物件 使用insert的語句,兩個表是一對多的關係 2.獲得主鍵語法 1.preparedstatement 建立 ps時,指定返回主鍵 ps conn.preparestatement sql,statement.return generated key...

獲得資料庫中所有的表

在資料庫中一般都會有乙個系統表來記錄下所有的使用者表或檢視,儲存過程等等的.名字就叫sysobjects.所有要查詢出所有的表可以用以下語句 sql2000 select from sysobjects where xtype u或 v 或 p access select from msysobje...