Solved

extract column names of a table into Excel

Posted on 2004-08-30
6
512 Views
Last Modified: 2013-12-12
I have to extract 22 table names and all their column names into a Excel spreadsheet.

thank you
0
Comment
Question by:vijadon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 11

Expert Comment

by:cjjclifford
ID: 11930521
Use an ODBC data source with the following SQL:

SELECT table_name, column_name, data_type FROM user_tab_columns

Or, do the following in SQLPlus:

SQL> set colsep,
SQL> spool temp.csv
SQL> SELECT table_name, column_name, data_type from user_tab_columns
SQL> spool off

Then load the created "temp.csv" file into Excel...

Cheers,
C
0
 
LVL 13

Accepted Solution

by:
anand_2000v earned 125 total points
ID: 11932483
simpler
SQL> set colsep,
SQL> spool temp.csv
SQL> SELECT table_name||','||column_name||','|| data_type from user_tab_columns
SQL> spool off
0
 
LVL 11

Expert Comment

by:cjjclifford
ID: 11939749
anand_2000v - how does that differ from mine????? Actually, how is it even simpler??? you've added ||','|| blocks which were not necessary with my answer ("set colsep," does this!)

vijadon (Author) - you should accept the first answer where there are duplicates.

Cheers,
C.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Expert Comment

by:anand_2000v
ID: 11939782
I agree that your answer was the first correct answer. you are absolutely right. I don't have a problem if the answer is awarded to you.
0
 
LVL 13

Expert Comment

by:anand_2000v
ID: 11939790
I had missed out reading the colsep option when I replied.
0
 
LVL 11

Expert Comment

by:cjjclifford
ID: 11939890
anand_2000v, cheers (sorry if I came across a bit agressive, lots of "?" above... my new born baby is a little light on the sleeping and I'm a little short on sleep :-))

vijadon?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that useā€¦
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question