Vishravars Ramasubramanian

Greenhorn
+ Follow
since Apr 28, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vishravars Ramasubramanian

Thank you all. I am clear now. Later used profiler to find the commented part of the query. I felt hard to locate the bug because that one line comment was hidden in the dark. So got confused with the way the comments work.

Thanks all once again.
eek that was a typo. union is part of the string .

and yes putting // comments will work fine and -- wont make sense in other db's.

Point needed is why the result is that way.
I found a peculiar problem when i tried retrieving values from a table using JDBC.

I had 2 parts of a queries separated by UNION. When i used the m$ sql comment "--" in the first part of the query, the code after union did not get executed. Say for example:-

sbSample.append("select 'abcd', 'efgh'");
sbSample.append("--order by 1");
union
sbSample.append("select 'ijkl', 'mnop'");

(sbSample is a StringBuffer type)
then executing the query using create statement to follow.

the result was
abcd
efgh (assume that i printed the result in some loop)

I have not tried any other combination yet.

Explanation/tips on how to observe this more detailed are highly welcome.
ya. sure. i will try with both

embedded where clause options
and try all the queries atomically.

thanks for the response
Yes. I used the M$ sql profiler and took the trace. it shows 40secs for the query executed through java pgm and 3 secs through query analyser. and there is not much n/w traffic to my amazement. i tried that with a linux tool.

will there be any prob in the case of too much arguements (43 in total) and it has many sub queries in the select list awaiting input at runtime
sorry for the continuation. i missed a small point.

i have about 48 inputs (?) in the WHERE clause and query is quite long (about 100 liner)
Hi. I am basically executing a query from a java pgm. I stored the query in String buffer and conv. it to a string and using prepared stmnt to executeQuery() (no loop). the query took 40 secs to exec. but when i ran the same in M$ query analyser, it took only 3 secs.

I dont use views, i use tables.
with all the keys in tact and in proper order

any guess what could be wrong.. because i dont feel there could be a huge diff in time b/w query analyser and a java pgm DB execution !!