維護數字字典時,大量匯入資料庫的列注釋、類型等相關資訊

來源:互聯網
上載者:User

標籤:style   blog   http   color   資料   ar   2014   div   

匯出的格式形如:

 

 

use ppdai_vd;goSELECT  ‘ppdai_vd‘ AS 資料庫名,    a.name as ‘表名‘ ,    isnull(e.value,‘‘) as ‘表注釋‘,    CONVERT(VARCHAR(19), a.create_date ,23) AS ‘建立時間‘,    b.column_id as ‘欄位序號‘,    b.name as ‘欄位名‘,    ‘資料類型‘ =      case        when c.name IN (‘varchar‘,‘nvarchar‘,‘varbinary‘) and b.max_length =-1        then c.name +‘(max)‘       when c.name in (‘varchar‘,‘nvarchar‘,‘char‘,‘nchar‘,‘binary‘,‘varbinary‘) and b.max_length>0        then c.name +‘(‘+CAST(b.max_length AS VARCHAR)+‘)‘        else c.name        end        ,isnull(d.[value],‘‘) as ‘欄位注釋‘    FROM  sys.objects a inner join  sys.columns b on  a.object_id=b.object_id and a.type=‘U‘  left join   sys.types c   on  b.user_type_id = c.user_type_idleft join   sys.extended_properties d on b.object_id=d.major_id and b.column_id=d.minor_idleft join   sys.extended_properties e on a.object_id =e.major_id and e.minor_id=0--where a.object_id = object_id(‘user‘)     order by a.name,b.column_id

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.