ngund
ngund

Reputation: 95

Get results from mssql stored procedure with jdbc

I have quite complex stored procedure in MSSQL database that returns no value (just default integer code) and has select statement that produces single string ('OK' or error message).

I can see this result in Management Studio's Results tab executing procedure with exec my_procedure 'param1', 'param2'. However, when I try to execute this query with jdbc boolean resultExist = preparedStatement.execute(sqlString), I get my resultExist variable set to false and no result set is available.

Is there any way to obtain result produced by stored procedure without changing it?

Upvotes: 1

Views: 1415

Answers (1)

lance-java
lance-java

Reputation: 28101

Stored procedures can return multiple ResultSets. See here for sample code to access all ResultSets.

Upvotes: 1

Related Questions