InfoSet Wizard not Autocreating from a stored procedure

 10 Replies
 0 Subscribed to this topic
 22 Subscribed to this forum
Sort:
Author
Messages
Thomas Harlan
Basic Member Send Private Message
Posts: 7
Basic Member

Hola!

I'm trying to set up an InfoSet to drive a SmartNote, but the query I'm starting with is based on a SQL 2000 stored procedure (in McKesson MM, actually) that uses a slew of temp tables and IF/logic - and all of that is confusing the InfoSet wizard.

When I try and auto-create the InfoSet, I get this error:

ADMINUI1010: ... The statement did not return a result set

The query runs fine in Toad or Query Analyzer; so obviously rows *are* coming back... just not in a way that the InfoSet Wizard understands.

Anyone else run into this? And solve it? 8-)

Thanks, Thomas

Matthew Nye
Veteran Member Send Private Message
Posts: 514
Veteran Member
Thomas,

You can actually run a stored procedure from an InfoSet. Just be sure to set that at the top of Step 1. If thats unacceptable you could also try putting a SELECT statement at the very end. This will allow you to define one column in the infoset and save i, although, it may be that you cant use control structure SQL (IF THE ELSE) in the InfoSet editor.

hth
matt
If any of my answers were helpful an endorsement on LinkedIn would be much appriciated! www.linkedin.com/pub/matthew-nye/1a/886/760/
Thomas Harlan
Basic Member Send Private Message
Posts: 7
Basic Member
Matt,

tried the stored procedure approach first, actually. And that got me the same error.

I also restructured the SQL in the query to make sure the very last statement was a SELECT FROM... - but no luck there either.

However, there is an IF THEN structure at the very end, to pick between two different versions of the last SELECT. I'll try removing that and see if we get the proper result.

Thanks!
-- Thomas
Thomas Harlan
Basic Member Send Private Message
Posts: 7
Basic Member
And... same result from making sure there is a single SELECT as the last statement. A puzzler!
Matthew Nye
Veteran Member Send Private Message
Posts: 514
Veteran Member
Ok, I will test this out tonight. Its tricky, I remember that I just dont recall off the top of my head what the solution is.
If any of my answers were helpful an endorsement on LinkedIn would be much appriciated! www.linkedin.com/pub/matthew-nye/1a/886/760/
Thomas Harlan
Basic Member Send Private Message
Posts: 7
Basic Member
Matt,

thanks! We greatly appreciate that.
Matthew Nye
Veteran Member Send Private Message
Posts: 514
Veteran Member
ok looks like the way I got it to work was to actually select the "Query" option but still run your stored proc like normal. Then just define one column as a key. My SP didnt return any result sets.

Let me know if this works.
If any of my answers were helpful an endorsement on LinkedIn would be much appriciated! www.linkedin.com/pub/matthew-nye/1a/886/760/
Thomas Harlan
Basic Member Send Private Message
Posts: 7
Basic Member
When you say, select "Query" but run your stored procedure like normal you mean:

EXEC PMM.dbo.up_rpt_InvDiscr '',0,'', 0.0,0.0,0

I set that up, then add one of the columns in the expected result set as a KEY row in the InfoSet, then click AutoCreate... and still get the same error. But I'd guess I'm doing that part incorrectly... how are you doing this:

Then just define one column as a key

Matthew Nye
Veteran Member Send Private Message
Posts: 514
Veteran Member
well, its just defined as a single column of a string type. Now that I think about it, I believe what I had to do was trick it. Try defining the infoset using this SQL:

SELECT 1

Save it, update it, then go in and put your stored proc. My stored proc ends with and IF THEN ELSE too so that shouldnt be the problem.
If any of my answers were helpful an endorsement on LinkedIn would be much appriciated! www.linkedin.com/pub/matthew-nye/1a/886/760/
Thomas Harlan
Basic Member Send Private Message
Posts: 7
Basic Member
Finally got this to work by taking a more brute-force approach:

1. Dispensed with the stored procedure all together. Took the code from the sp and used it as a straight query.
2. Replaced all temp tables in the query (there were four) with table variables; aliased the table variables like regular tables.
3. Made sure there were no field names in square brackets ( [] ) which apparently the JDBC driver did not like.
4. Made sure the final statement in the query was the SELECT against the table variables. There had been an IF/THEN structure switching between two different versions of the final query (based on a parameter from the stored procedure, which was also dispensed with).

Then that worked fine in the InfoSet wizard, etc.
Matthew Nye
Veteran Member Send Private Message
Posts: 514
Veteran Member
Wow, thats intereesting. Just an FYI, InfoSets will treat anything with square braces as a parameter and prompt you for values when you update the InfoSet
If any of my answers were helpful an endorsement on LinkedIn would be much appriciated! www.linkedin.com/pub/matthew-nye/1a/886/760/