[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

How to extract table names from a SQL query

Posted on 2009-04-17
4
Medium Priority
?
432 Views
Last Modified: 2013-11-23
Hi all,

I have a list of SQL query given in a text file.
The text file has to be read line by line and the table names have to be extracted and saved in a csv file.

Is there any way to extract the table names?

Thank you!

0
Comment
Question by:Fionageo
3 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 24166525
You'd need a sql parser to do that. Try googling on the two words
0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 24166557
use the following to reqad the file

http://helpdesk.objects.com.au/java/how-do-i-read-a-text-file-line-by-line

and try this to parse the lines

http://www.gibello.com/code/zql/

0
 
LVL 10

Expert Comment

by:Pramod Kumar
ID: 25344123
           Class.forName(".......");
            Connection con = DriverManager.getConnection("","","");
            Statement st = con.createStatement();
            ResultSet rs = st.executeQuery(".........");
            String tableName = rs.getMetaData().getTableName(1);
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month9 days, 5 hours left to enroll

590 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