We Recommend

SQL Cookbook SQL Cookbook
Written in O'Reilly's popular Problem/Solution/Discussion style, the SQL Cookbook is sure to please. Anthony's credo is: "When it comes down to it, we all go to work, we all have bills to pay, and we all want to go home at a reasonable time and enjoy what's still available of our days." The SQL Cookbook moves quickly from problem to solution, saving you time each step of the way.


Posted By

thecrumb on 01/23/08


Tagged

sql Oracle


Versions (?)


Get Columns and Comments (Oracle)


Published in: SQL 


Get all my columns and comments.

  1. SELECT col.table_name
  2. ,col.column_name
  3. ,col.data_type
  4. ,col.data_default
  5. ,col.nullable
  6. ,case when col.data_type = 'varchar2' then col.data_length else NULL end AS data_length
  7. ,com.comments
  8. FROM user_col_comments com
  9. JOIN user_tab_cols col
  10. ON com.table_name=col.table_name
  11. AND com.column_name=col.column_name
  12. ORDER BY col.table_name, col.column_id

Report this snippet 

You need to login to post a comment.