Call stored procedure from Elastic Database in Azure

眉间皱痕 提交于 2019-12-24 16:26:02

问题


Here is the scenario:

  • Elastic Database A connected to database B
  • Database B contains stored procedure that returns result set needed in database 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.

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?


回答1:


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. E.g. 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. This utility proc is detailed here

This capability is not yet available with Elastic Query's "Vertically Partitioned" scenario (e.g. 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.



来源:https://stackoverflow.com/questions/34131580/call-stored-procedure-from-elastic-database-in-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!