(异步)执行本机编译的存储过程

(Async) execution out of a natively compiled stored procedure

我有一个本机编译的存储过程,我想异步执行另一个存储过程。背景是,我需要尽可能快地存储一些暂存数据(在我本机编译的存储过程中),我想调用另一个异步存储过程来进一步处理我的数据(但没有 "blocking" 当前本机编译存储过程)。

有人知道这是否可能吗?

这是我想要的示例:

create procedure [Staging].[spProcessXXX]
with native_compilation, schemabinding, execute as owner
as 
begin atomic
with (transaction isolation level=snapshot, language=N'us_english')


    -- 1.

    -- do my performance-relevant stuff here


    -- 2.

    -- exec SP_XYZ (async, for example over SQL Job Agent or Service Broker)


end 

这不可能。让应用发出异步调用。

备选方案:如果这是一个非本地过程,您可以使用服务代理。因此创建一个非本机编译的包装程序。该包装器调用本机过程并可以使用服务代理。