Solved

extract column names of a table into Excel

Posted on 2004-08-30
6
510 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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Action link in Union Reports Not Working in OBIEE 11g 1 88
query in Oracle forms Builder 2 53
Concat multi row values of a field in oracle 6 65
Help on model clause 5 32
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
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 shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

803 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