【发布时间】:2014-02-24 16:10:19
【问题描述】:
我需要创建嵌套存储过程。在接下来的事情中。
Create proc MyVoidProc
as
Begin
Waitfor Delay '00:00:05'
Print 'This has been executed'
End
GO;
Create Proc TestNestedSP
as
Begin
Select * From sys.tables --Some select statement that needs to be returned
Exec MyVoidProc --This does not return anything.
End
是否可以在不等待MyVoidProc 执行的情况下从TestNestedSP 返回select 语句。 MyVoidProc 不返回任何内容,但需要在 TestNestedSP 的末尾执行,因为它需要从调用它的过程中捕获元素。 MyVoidProc 将需要不同的时间来执行,因此我不会等待它。只需将重要的内容返回给用户,并在用户不知情的情况下完成处理。
【问题讨论】:
-
那你为什么不启动一个执行内部 SP 的作业呢?
标签: sql sql-server stored-procedures asynchronous sql-server-2012