公司現在使用的數據庫都是sql,軟件在開發的過程中的數據庫的設計會有著很多的變化,這就帶來了很多的更新繁瑣的工作,以至公司的軟件的數據庫的文檔得到不及時的更新,勢必影響著相關的一系列的工作的執行。
在這邊結合了去年工作的實踐,提出一種比較方便的數據庫更新與數據庫文檔同步的方法,這個方法的原理也很簡單,它主要是利用了各種數據庫的系統表,聯合創建視圖,把有關數據庫結構的主要字段提取出來,再利用excel中的獲取外部數據的工具的功能,直接把數據庫的結構一項項的讀取出來,再利用excel的數據更新自動的獲取數據結構上的變化,剩下的工作就只有把數據庫結構中新的字段做備注就可以.
附加sql:
create view v_all_table as select o.name t_name, l.name t_columns, t .name t_type, l.length, l.isnullable, c.text, l.colorderfrom sysobjects o, syscolumns l, systypes t, syscomments cwhere o.xtype = 'u' and o.id = l.id and l.xtype = t .xtype and l.cdefault = c.id and l.cdefault <> 0union select o.name t_name, l.name t_columns, t .name t_type, l.length, l.isnullable, '' as text, l.colorderfrom sysobjects o, syscolumns l, systypes twhere o.xtype = 'u' and o.id = l.id and l.xtype = t .xtype and l.cdefault = 0