• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 494
  • Last Modified:

Accessing temp table result set through JDBC

Hello,

I have written a procedure in MS SQL. In this procedure, I've created a temp table and put data inside this table.

I do a select * from this temp table and then drop the table.

Now, I want to access this result set in JDBC, but it gives me an error "Statement does not return any result set". If I run the procedure from within SQL itself, the result set comes up fine.

Please suggest.
0
the_7th_king
Asked:
the_7th_king
  • 3
  • 2
1 Solution
 
DcpKingCommented:
If it's a temp table named with a # then it should go away on its own when your connection drops, so just don't delete it. OTOH, if you're going to call the proc repeatedly you should check if it exists and kill it if it does, and then recreate it and use it.

You might also look at using Table Vars instead of temp tables - they go away automagically after you leave the proc.

If you still don't get any results according to JDBC then please post your code.
0
 
the_7th_kingAuthor Commented:
Even if I stop manually dropping the temp tables, the result set still cannot be displayed in JDBC
0
 
DcpKingCommented:
Well, it's 12 years since I used JDBC, and it had some wild bugs then! Anyhow, check this out.  There's an answer from a guy who upgraded from SS2000 to SS2005 and it stopped giving him back an answer maybe that'll help you!

hth

Mike
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
DcpKingCommented:
sorry - missed this one!
0
 
Anthony PerkinsCommented:
I have written a procedure in MS SQL. In this procedure, I've created a temp table and put data inside this table.
Post your code.
0
 
the_7th_kingAuthor Commented:
putting a "NO COUNT" did the trick!

thanks a lot!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now