sql存储过程清除结果集
我是否可以清除存储过程已收集的多个结果集,以便创建的下一个结果集成为该过程返回的第一个结果集?
Can I clear the multiple result sets that a stored procedure has already gathered so that the next result set that is created becomes the very first result set returned by the procedure?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这取决于数据库。在Sql Server中,一旦结果集发送出去,它就消失了。接收应用程序/代码必须处理它。如果您需要这样的逻辑,请将结果收集到临时表中,并仅在过程结束时返回所需的内容。
this would depend on the Database. In Sql Server, once the result set is sent, it is gone. The receiving application/code must deal with it. If you need to have logic like this, gather the results into a temp table and only return what is needed at the end of the procedure.
正如 KM 所说,这有点取决于数据库。您能解释一下您的存储过程如何收集多个结果集吗?您是通过多个联合还是通过创建动态 sql 语句来实现此目的?
As KM said it depends a bit on the database. Can you explain how your stored procedure gather multiple result sets? Are you achieving this via multiple unions or by creating a dynamic sql statement ?