简体   繁体   中英

Call SQL Server stored procedures from SAP HANA

We are using a SAP HANA environment to connect to various databases (SQL Server, Oracle, Teradata). Now one of our sources (the SQL server one) contains a lot of stored procedures to calculcate transient values. We would need to have these values as well in SAP HANA and are thinking about the best way:

  1. Ideally, HANA can call the stored procedure of SQL and get back the result data, but I could not find information about this. Is this possible?
  2. Another option is to write a little program (Java) in HANA that can call the stored procedure on SQL Server and then give back the data (either directly, or by storing is some temporary table on SQL side and then read in with HANA).
  3. Other ideas?

Does anybody has suggestions on this?

1 I don't think you can directly call to external Stored Procedure directly, however you could go with 2nd option by writing a java program that can call the stored procedure on SQL Server and then give back the data.

Or

If the external stored procedure is bound to a web service, etc... then from HANA you could have an XS service using outbound connectivity to call that service which will call the stored proc.

Reference

Reference for Outbound Connectivity

As long as you can run SQL queries you could see if using OPENROWSET would work for you.

Using OPENROWSET with stored procedure as source you can then consume data as it would SQL rowset.

SELECT * FROM
OPENROWSET ('SQLOLEDB','Server=(local);TRUSTED_CONNECTION=YES;','exec master.dbo.sp_who')
AS tbl

Using SAP HANA Smart Data Integration (SDI) remote sources, you are able to access/federate to remote tables, views and stored procedures.

First create the remote source, then wrap the Stored Procedure in a Virtual Procedure, these can be created via the Web IDE or SQL. You would use the CREATE VIRTUAL PROCEDURE statement as described below.

Create Virtual Procedure with Web IDE

CREATE VIRTUAL PROCEDURE via SQL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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