?
Solved

extract column names of a table into Excel

Posted on 2004-08-30
6
Medium Priority
?
516 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 375 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
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

764 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