By default SQL Server JDBC driver returns result set of all SELECT query executed in a stored procedure. I have to call CallableStatement.getMoreResults() and close all of them. I do not want any result set as return value when executing SQL Server stored procedurel; are there any ways to prevent returning result set when executing SQL Server stored procedure?
A:
I'm not sure I understand. Are you executing select statements within your procedure that you don't want returned? Is it the rows affected that is being returned that is the result set you don't want? If its the latter you can add SET NOCOUNT ON to the beginning of the procedure to keep the rows affected from being returned.
Gratzy
2010-01-25 17:10:00
SELECT statements returned as result set. I am using CallableStatement statement = cx.prepareCall(ProcedureSQL)
Venkat
2010-01-25 17:43:12
NOCOUNT ON didn't work for me.
Venkat
2010-01-27 21:02:23
A:
statement.executeUpdate()
should execute your sql without returning a resultset.
alasdairg
2010-01-25 17:18:02
currently I am using CallableStatement statement = cx.prepareCall(ProcedureSQL); will give a try with executeUpdate()
Venkat
2010-01-25 17:43:37
When trying with executeUpdate to run stored procedure it throws exception:com.microsoft.sqlserver.jdbc.SQLServerException: INSERT/UPDATE cannot be executed, please retry.
Venkat
2010-01-25 17:54:48