Results 1 to 13 of 13
Thread: How to get Record Names?
- 08-17-2011, 03:33 AM #1
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
- 08-17-2011, 07:24 AM #2
Recommended reading: How to ask questions the smart way
db
- 08-17-2011, 07:45 AM #3
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
Hi Darryl
what is wrong in my question most important is how to get that solution man, always you bang on English, you cant expect everyone to be like you, i am weak at English, your are a moderator man you should understand our problem and try giving solution and then recommend us to read, not just always give us link how to improve English and stuff. I am dam sure i have logged into java-forums not English tutorials website.
Regards
Sandeep
- 08-17-2011, 09:17 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
I think Darryl is pointing out that your question, as it stands, makes no sense.
What are you trying to do?
Do you have some code (or at least pseudo code) to show what it is you are trying to figure out?
- 08-17-2011, 10:27 AM #5
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
Hi tolls,
i thought you will understand me, because you were the one who usually answer my question more appropriately.
Question is simple tolls, i will fetch sql statements for views present in database, later i want to pass these fetched sql statements one by one such that i have to get TableNames and ViewNames present in fetched sql Statement.
What logic can be employed?
Sandeep
- 08-17-2011, 10:37 AM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
What do you mean by "fetched SQL statements"?
Do you mean the result sets?
- 08-17-2011, 11:01 AM #7
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
Hi Tolls
if you execute this sql whatever it retrieves is Fetched Sql Statement for that view name.Java Code:select OBJECT_DEFINITION(OBJECT_ID('ViewName')) AS TABLE_NAME
Sandeep
- 08-17-2011, 11:09 AM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
It's a resultset (in Java).
Or fetched rows (in most DBs).
Is that what you want to know?
What to do with the ResultSet? That depends on what you want to do with that data.
- 08-17-2011, 11:33 AM #9
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
There is nothing to do with ResultSet, i wanted to know how to get TableNames and ViewNames from that Sql Fetched Statements
Sandeep
- 08-17-2011, 11:42 AM #10
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
No, it's a ResultSet.
Whether the rows in that are simply a list of table names, or some STRUCT or other, is irrelevant.
What is the Type returned by OBJECT_DEFINITION?
What DB are we on here?
- 08-17-2011, 11:53 AM #11
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
we are using MS sql server2005, it returns of type varchar
Sandeep
- 08-17-2011, 12:03 PM #12
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
So what's wrong with:
?Java Code:ResultSet rs = yourSQL.execute(); while (rs.next) { System.out.println(rs.getString(1)); }
What you do in the loop is entirely up to you. That there will print out all the "TABLENAMES" returned by your query.
- 08-17-2011, 12:13 PM #13
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
Similar Threads
-
How can I read a binary file record by record in java?
By ZigVe in forum New To JavaReplies: 9Last Post: 07-09-2011, 07:15 PM -
name in a range of names
By Evii0 in forum New To JavaReplies: 2Last Post: 04-05-2011, 06:35 AM -
Set names utf8
By initmax in forum JDBCReplies: 1Last Post: 11-22-2009, 10:29 AM -
how to record multiple input names and output later in program
By jbajwa1 in forum New To JavaReplies: 4Last Post: 10-02-2008, 10:05 PM -
how to get the names of the files
By mary in forum Advanced JavaReplies: 2Last Post: 08-05-2007, 04:01 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks