oracle 我可以在 SSRS 中跨数据源“加入”吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3937015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 21:42:22  来源:igfitidea点击:

Can I "join" across datasources in SSRS?

sql-serveroraclereporting-servicesjoin

提问by dkackman

I've got two datasources, one Oracle and one Sql Server. Due to circumstances that predate me (as in it was like this when I found it) some columns in the Oracle database contain PKs from lookup tables in the Sql Server database.

我有两个数据源,一个 Oracle 和一个 Sql Server。由于我之前的情况(就像我发现它时的情况一样),Oracle 数据库中的某些列包含来自 Sql Server 数据库中查找表的 PK。

I am attempting to create a Sql Server Reporting Services report that will combine data from both the Oracle and Sql Server database; where the data to be reported is partially from Oracle but some of the values needs to be looked up in Sql Server.

我正在尝试创建一个 Sql Server Reporting Services 报告,它将合并来自 Oracle 和 Sql Server 数据库的数据;其中要报告的数据部分来自 Oracle,但某些值需要在 Sql Server 中查找。

I've got the datasources. I've got the DataSets. I just can't figure out how to show both datasets in the same tabular report.

我有数据源。我有数据集。我只是不知道如何在同一个表格报告中显示两个数据集。

Is this possible? If so how so? I'd rather not resort to a db link in one or the other databases as I'd like to handle this on the reporting side.

这可能吗?如果是这样怎么办?我不想在一个或其他数据库中使用 db 链接,因为我想在报告方面处理这个问题。

采纳答案by Joe Stefanelli

I don't think you can join directly, but you might be able to add a subreport that would query the second datasource by using the foreign key from the first datasource as a parameter. See: How to: Add a Subreport and Parameters (Reporting Services).

我认为您不能直接加入,但您可以添加一个子报表,通过使用第一个数据源中的外键作为参数来查询第二个数据源。请参阅:如何:添加子报表和参数(报表服务)

回答by user3644997

You could also try using the Lookup and Lookupset functions within your tablix.

您还可以尝试在 Tablix 中使用 Lookup 和 Lookupset 函数。

Lookup is a 1 to 1 join while Lookupset is 1 to many and may need you to have your data concatenated if you want a set of strings out.

Lookup 是 1 对 1 连接,而 Lookupset 是 1 对多连接,如果您想要一组字符串,可能需要您将数据连接起来。

For Lookup the following is from the MSDN site with some tweaks for my simple mind

对于查找,以下内容来自 MSDN 站点,并针对我的简单想法进行了一些调整

Lookup(Field you are joining from, Field you are joining to, Field you want back, Dataset of the field you want back)

The tablix should be linked to the dataset of your source (joining from).

tablix 应该链接到源的数据集(加入)。

And just realised this is from 2010, not 2014...so a necro-post!

刚刚意识到这是从 2010 年开始的,而不是 2014 年......所以是一个死灵帖!

回答by Luis Gouveia

You could create a linked server that would contain data from both instances. From the SSRS point of view you would have one single datasource.

您可以创建一个链接服务器,其中包含来自两个实例的数据。从 SSRS 的角度来看,您将拥有一个单一的数据源。

回答by DForck42

you could also embed a table inside another table and pass the primary key to the embeded table.

您还可以在另一个表中嵌入一个表并将主键传递给嵌入的表。

回答by erbsock

You can use heterogenous services or oracle transparent gateway to run the report off the oracle side. Oracle can query the data from the SQL side.

您可以使用异构服务或 oracle 透明网关在 oracle 端运行报告。Oracle 可以从 SQL 端查询数据。