【SQL】如何獲得表及欄位的說明資訊(comment)的建立指令碼
當遷移到測試資料庫後發現註釋資訊均為亂碼後可以使用這個方法快速的恢復。
1.查詢表級別的註釋資訊
select 'COMMENT ON TABLE '||table_name||' IS '''||comments||''';' from user_tab_comments;
2.查詢表中列的註釋資訊
select 'COMMENT ON COLUMN '||table_name||'.'||COLUMN_NAME||' IS '''||COMMENTS||''';' from user_col_comments;
以上提到了兩個檢視,一個是user_tab_comments,另一個是user_col_comments,這兩個檢視分別記錄了表一級別的和行一級別的註釋資訊。
oralce官方文件中是這樣描述的:
ALL_TAB_COMMENTS
ALL_TAB_COMMENTS displays comments on the tables and views accessible to the current user.
Related Views
-
DBA_TAB_COMMENTS displays comments on all tables and views in the database.
-
USER_TAB_COMMENTS displays comments on the tables and views owned by the current user. This view does not display the OWNER column.
Column | Datatype | NULL | Description |
---|---|---|---|
OWNER | VARCHAR2(30) | NOT NULL | Owner of the object |
TABLE_NAME | VARCHAR2(30) | NOT NULL | Name of the object |
TABLE_TYPE | VARCHAR2(11) | Type of the object | |
COMMENTS | VARCHAR2(4000) | Comment on the object |
ALL_COL_COMMENTS
ALL_COL_COMMENTS displays comments on the columns of the tables and views accessible to the current user.
Related Views
-
DBA_COL_COMMENTS displays comments on the columns of all tables and views in the database.
-
USER_COL_COMMENTS displays comments on the columns of the tables and views owned by the current user. This view does not display the OWNER column.
Column | Datatype | NULL | Description |
---|---|---|---|
OWNER | VARCHAR2(30) | NOT NULL | Owner of the object |
TABLE_NAME | VARCHAR2(30) | NOT NULL | Name of the object |
COLUMN_NAME | VARCHAR2(30) | NOT NULL | Name of the column |
COMMENTS | VARCHAR2(4000) | Comment on the column |
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-586836/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql建立表的時候對欄位和表新增COMMENTMySql
- sql2005 獲取表欄位資訊和檢視欄位資訊SQL
- SQLServer SYSPROCESSES表欄位解說明SQLServer
- 手工建立資料庫的全部指令碼及說明(轉)資料庫指令碼
- 教你手工建立資料庫的全部指令碼及說明資料庫指令碼
- 手工建立資料庫的全部指令碼及說明 (轉)資料庫指令碼
- [20221216]建立修改表欄位統計資訊modcol.sql指令碼.txtSQL指令碼
- 獲取sql server 2008表欄位資訊SQLServer
- ms sql 獲取表欄位的屬性SQL
- [原創]如何獲得SBO的資料表中文描述和資料表的中文欄位
- 如何獲得C4C裡某個code欄位對應的描述資訊
- (轉)Sql Server 快速檢視錶結構(表描述及欄位說明)SQLServer
- PhpCms自定義欄位的使用說明PHP
- 從Sql server 2008獲取表欄位屬性資訊,註釋資訊SQLServer
- SQL Server複製的表中如何修改欄位SQLServer
- 【DBMS_RANDOM】從 DBMS_RANDOM建立指令碼獲得隨機資訊的生成方法random指令碼隨機
- SQL Server中獲取資料庫名、表名、欄位名和欄位註釋的SQL語句SQLServer資料庫
- Oracle 動態效能表 v$session & v$process各個欄位的說明OracleSession
- 崩潰日誌的欄位簡單說明
- SQL新增表欄位SQL
- 獲取top N cpu pid的sql資訊指令碼SQL指令碼
- TSM for Oracle備份指令碼及策略說明Oracle指令碼
- 一次捕獲SQL調優資訊的指令碼 sql9.sqlSQL指令碼
- 一次捕獲SQL調優資訊的指令碼 sql10.sqlSQL指令碼
- 用sql語句建立表的時候給列指定說明(轉)SQL
- 【OH】常用資料字典指令碼說明 SQL Scripts指令碼SQL
- 資料庫欄位簡寫說明資料庫
- mysql學習之-show table status(獲取表的資訊)引數說明MySql
- 獲取表的結構、欄位描述等
- 查詢oracle表的資訊(表,欄位,約束,索引)Oracle索引
- sql查詢當前使用者所有表、欄位及相關注釋資訊SQL
- 獲取sql server資料庫中所有庫、表、欄位名的方法SQLServer資料庫
- MongoDB檢視執行計劃方法及相關欄位說明MongoDB
- sql2008 獲取表結構說明SQL
- 怎樣獲得資料表中某個欄位的第二個最大值
- 獲得Azure訂閱LoadBalancer的指令碼指令碼
- 淘寶/天貓獲得淘寶商品詳情原資料 API 返回值說明 支援定製需求 定製欄位API
- 如何在linux中建立特定的指令碼註釋資訊Linux指令碼