快速生成資料庫列列舉的小技巧

2022-01-14 10:58:04 字數 992 閱讀 9783

需要對資料庫的列生成列舉比如 dict 表結構是:

create

table

[dbo].

[dict](

[id][

int]

identity(1

,1) not

null,[

pid]

[int

]null,[

key]

[varchar](

50) 

null,[

value][

varchar](

128) 

null,[

sortid][

int]

notnull

,constraint

[pk_dict

]primary

keyclustered([

id]asc)

with

(pad_index  

=off

, statistics_norecompute  

=off

, ignore_dup_key 

=off

, allow_row_locks  =on

, allow_page_locks  =on

) on

[primary]) 

on[primary

]要生成的列舉是:

public

enum

masterindex

可在 sql 2008 裡快速生成:

select

name +'

,'from

.sys.all_columns 

where

.sys.all_columns.

object_id

=object_id('

[dict]')

sql2008 給開發者提供的最大好處是 列出成員 了, 快捷鍵和 vs 一樣. (ctrl+j) . 超爽.

生成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...

自動生成資料庫字典

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 gocreat...

sessionFactory 生成資料庫表

tomcat 啟動時會讀取web.xml檔案 根據其中的配置 contextconfiglocation org.springframework.web.context.contextloaderlistener 1.首先讀取.中的配置資訊,建立contextloaderlistener 的例項物件...