Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 489
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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