1. 程式人生 > >如何從SQL資料庫中獲取某個欄位的型別和長度

如何從SQL資料庫中獲取某個欄位的型別和長度

1.select column_name,data_type,character_maximum_length
from information_schema.columns
where table_name='TableName' and column_name='ColName'

2.information_schema.columns是系統檢視,記錄表的欄位的相關資訊。