问题描述
限时送ChatGPT账号..我正在从另一个存储过程调用一个存储过程,并且我正在调用的过程有一个输出参数.然后我将输出值通过管道传输到局部变量中.这一切都很好,但问题是这个过程也有一个select
语句,所以当我exec
时,过程的结果在返回最终结果集.
I am calling one stored procedure from another, and the procedure I am calling has an output parameter. I am then piping the output value into a local variable. That's all well and good, but the problem is that this procedure also has a select
statement in it, so when I exec
, the results of the procedure are being returned in the final results set.
有没有办法简单地获取输出参数的值,而忽略其他所有内容?
Is there a way to simply get the value of the output parameter, and ignore everything else?
推荐答案
虽然从技术上讲是的,但你不应该这样做.引擎消耗资源来生成您忽略的结果集.您还可能会产生不必要的争用.如果您不需要结果集,则需要另一个过程来只产生您想要的输出.
While technically yes, you shouldn't do it. The engine consumes resources to produce the result set you ignore. You may also produce unnecessary contention. If you don't need the result set, you need another procedure that should only produce the output you desire.
这篇关于是否可以在忽略 SELECT 语句的同时执行具有输出参数的 T-SQL 存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论