自動生成資料庫字典

2021-06-14 16:21:05 字數 1090 閱讀 5817

1.首先需要填寫表的每一列的說明

2.建立試圖

go

/****** object: view [dbo].[sura_view_dbdictionary] script date: 05/31/2013 17:19:19 ******/

set ansi_nulls on

goset quoted_identifier on

gocreate view [dbo].[sura_view_dbdictionary]

as/**

*曹飛龍新建資料庫字典

* test_db為資料庫的名字

**/select c.name as tablename, a.name as colname, d.data_type as type, b.value

from sys.syscolumns as a left outer join

sys.extended_properties as b on a.colid = b.minor_id and a.id = b.major_id left outer join

sys.sysobjects as c on c.id = a.id left outer join

information_schema.columns as d on d.table_name = c.name and d.column_name = a.name

where (d.table_catalog = 'test_db')

go

3.查詢試圖

生成資料庫字典SQL

select 表名 case when a.colorder 1 then d.name else end,表說明 case when a.colorder 1 then isnull f.value,else end,字段序號 a.colorder,欄位名 a.name,標識 case when ...

php動態生成資料庫字典

php動態生成資料庫字典這是thinkphp框架下的 db m 這是thinkphp的資料庫連線對像 可根據實際情況自定義 db list db query show databases 獲取資料庫列表得出的資料結構如下 db list database 1510tea db db list dat...

生成mysql資料庫字典 快速生成資料庫字典

select tablename case when c.column id 1 then o.name else n end tabledesc isnull case when c.column id 1 then ptb.value end,n column id c.column id,co...