列出DB裡面所有的 TABLE 與 Column
'List All DB Table name
SELECT *
FROM INFORMATION_SCHEMA.TABLES
where table_type='base Table'
order by TABLE_NAME
'列出Table_Name,Column順序,Column欄位型態,Column,Column長度,ColumnIs_Identity
select
tab.name as Table_Name,
col.Column_id,
col.name as Column_Name,
t.name as Data_type,
col.Max_Length,
COL.Is_Identity
from sys.tables as tab
inner join sys.columns as col
on tab.object_id = col.object_id
left join sys.types as t
on col.user_type_id = t.user_type_id
order by
table_name, col.column_id