Assume I have some stored procedure (and I can't change it) which is returning a result set:
create procedure test_procedure
as
begin
select 1
end
I know that I can insert result set into table, so it would be hidden to the calling code:
declare @t table(i int)
insert into @t
exec test_procedure
Are there any other ways to hide returning result set from the calling code?
Updated
It looks like I've been a bit confusing. I'm looking only for T-SQL answers (not .NET ones).
To suppress MySQL stored procedure output, you can use variable. Let us first create a table. After calling the above stored procedure, we are not getting anything. Therefore, you need to use select statement to get the output.
A stored procedure does not have a return value but can optionally take input, output, or input-output parameters. A stored procedure can return output through any output or input-output parameter.
The reporting of syntax errors in a batch can be suppressed using the /*IGNORE:*(BATCH)*/ comment. The syntax error suppression can be useful in scenarios where the analyzed SQL script contains some SQLCMD specific commands.
No, there is no other solution. However, you should refactor your procedure to do only what you need. If you need the output for other calls, try to split the procedure into two.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With