简体   繁体   English

使用参数在SQL Server 2008的Advantage Database Server上执行过程

[英]Execute a procedure on an Advantage Database Server, from SQL Server 2008, with parameters

I currently use the statement: 我目前使用以下语句:

select * from openquery(linkedserver, 'select a,b,c, from nameofview') rowset_1.

What I want to do is call a stored procedure on the Advantage Database Server, and pass parameters to it. 我想做的是在Advantage Database Server上调用存储过程,并将参数传递给它。 The need for this is significant since the amount of data is growing at a fast pace. 由于数据量正在快速增长,因此这一需求非常重要。

Currently it takes over 15 minutes for a SQL report to present the data to the end user. 当前,SQL报告需要花费15分钟以上的时间才能将数据呈现给最终用户。 I have been asked to make changes to the report that will just add to the time. 我被要求对将要增加时间的报告进行更改。

If I can pass the parameters to the procedure, and have the procedure reduce the amount of collected data, instead of having the report gather all of the data and then reduce it, would be great. 如果我可以将参数传递给过程,并让过程减少收集的数据量,而不是让报表先收集所有数据然后减少数据量,那就太好了。

Using a stored procedure is similar to executing a query in Advantage, 使用存储过程类似于在Advantage中执行查询,

select * from openquery(linkedserver, 'execute procedure nameofproc(p1, p2)') rowset_1

To define stored procedure, the database must be defined in a data dictionary . 要定义存储过程,必须在数据字典中定义数据库。 The procedure may be implemented in DLL or SQL script 该过程可以用DLL或SQL脚本实现

A simpler way to improve performance may be just adding where clause to limit the amount of data returned by the server: 一种简单的提高性能的方法可能只是添加where子句以限制服务器返回的数据量:

select * from openquery(linkedserver, 'select a,b,c, from nameofview WHERE ...') rowset_1

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

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