Solved

extract column names of a table into Excel

Posted on 2004-08-30
6
507 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
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 about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now