简体   繁体   English

从Azure中的Elastic Database调用存储过程

[英]Call stored procedure from Elastic Database in Azure

Here is the scenario: 这是场景:

  • Elastic Database A connected to database B 弹性数据库A连接到数据库B
  • Database B contains stored procedure that returns result set needed in database A 数据库B包含返回数据库A所需结果集的存储过程

As far as I can tell the title can't be done. 据我所知,标题无法完成。 Only tables or views seem to work from my testing. 在我的测试中,似乎只有表格或视图有效。

So the next though was to yield the stored procedure as a view in database B then call the view from DB A. 因此,接下来的工作是将存储过程作为数据库B中的视图产生,然后从数据库A中调用该视图。

But views cant call stored procedures, even tried looking into table valued functions between the view and the stored procedure, but that's not permitted either. 但是视图不能调用存储过程,甚至不能尝试查看视图和存储过程之间的表值函数,但这也是不允许的。

How can I get the result set from a stored procedure in DB B into DB A? 如何从DB B中的存储过程获取结果集到DB A中?

Currently the only way to execute remote Stored Procedure calls using Elastic Query is when your External Data Source is defined using a "sharded" setup. 当前,使用Elastic Query执行远程存储过程调用的唯一方法是使用“分片”设置定义外部数据源时。 Eg you have defined an external source with 例如,您已使用

CREATE EXTERNAL DATA SOURCE MyElasticDBQueryDataSrc WITH
  (TYPE = SHARD_MAP_MANAGER, ...  )

In that case, you have access to a utility procedure called SP_Execute_Fanout which can be used to invoke a stored procedure (or perform ANY SQL operation) on each shard, and return a UNION ALL result set. 在这种情况下,您可以访问名为SP_Execute_Fanout的实用程序,该实用程序可用于在每个分片上调用存储过程(或执行ANY SQL操作),并返回UNION ALL结果集。 This utility proc is detailed here 此实用程序的过程在这里详细说明

This capability is not yet available with Elastic Query's "Vertically Partitioned" scenario (eg TYPE = RDBMS ), however we will be adding this type of functionality as the preview continues, so that invoking a remote stored proc in a single DB becomes simple. 此功能在Elastic Query的“垂直分区”方案(例如TYPE = RDBMS )中尚不可用,但是随着预览的进行,我们将添加这种类型的功能,因此在单个数据库中调用远程存储的proc变得很简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM