Contents
How can I get multiple result sets from a SQL stored procedure?
A Stored Procedure with multiple result sets To create it you just need to put at least two select statements in the Stored Procedure definition. CREATE PROCEDURE dbo. usp_WithTwoResultSets AS SELECT ‘First result set. ‘ AS Result; SELECT ‘Second result set.
Which method return the current result in multiple result statements?
If a stored procedure is returning multiple result sets, you should execute its CallableStatement object with the execute() method. In the case, an internal pointer will be maintained inside the CallableStatement object. This pointer is pointing the current result, which could be a result set or a update count.
Which method execute SQL statement which returns multiple results?
The “execute” method executes a SQL statement and indicates the form of the first result. You can then use getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s). getResultSet returns the current result as a ResultSet. It should only be called once per result.
What is Type_scroll_insensitive?
TYPE_SCROLL_INSENSITIVE. The constant indicating the type for a ResultSet object that is scrollable but generally not sensitive to changes to the data that underlies the ResultSet .
How to get multiple result sets to work?
In order to get multiple result sets working we need to drop to the ObjectContext API by using the IObjectContextAdapter interface. Once we have an ObjectContext then we can use the Translate method to translate the results of our stored procedure into entities that can be tracked and used in EF as normal.
How to get multiple resultset from one CallableStatement?
According to the Javadocs for Statement.getMoreResults (), you should also check that getUpdateCount () != -1 when looking for more result sets. Thanks for contributing an answer to Stack Overflow!
How to execute a simple stored procedure returning two result sets?
The first sample demonstrates how to execute a simple stored procedure returning two result sets. The second sample demonstrates a more complex stored procedure. It accepts an input parameter, further it returns a parameter (an output parameter), returns a value and a result set.
Can a SQL query return multiple result sets?
Each SQL statement within the UNION ALL query must have the same number of fields in the result sets with similar data types……… The answer: it is NOT possible. The only way: Run them as separate queries. Thanks for contributing an answer to Stack Overflow!