简体   繁体   English

SSRS报告数据源,用于查询多个数据库

[英]SSRS Report Data Source for Query with Multiple Databases

I have a dataset that pulls from multiple databases on the same server. 我有一个数据集,它从同一服务器上的多个数据库中提取。 Historically (without doing research) in this case I would set the data source to ReportServer (the database that houses the execution log for the server, ect.) and noticed the dataset doesn't seem to care what the data source is. 在历史上(无需进行研究),在这种情况下,我会将数据源设置为ReportServer(存储服务器执行日志的数据库等),并注意到数据集似乎并不关心数据源是什么。

I did a few hours of digging and couldn't find an answer. 我做了几个小时的挖掘工作,找不到答案。 When using (or in my case, unioning) multiple data bases in a dataset, what should the dataset data source be in Visual Studio? 在数据集中使用(或在我的情况下,合并)多个数据库时,数据集数据源在Visual Studio中应该是什么?

图片

Specifying the database in the connection string sets the starting, default database for the query. 在连接字符串中指定数据库可设置查询的初始默认数据库。 If your permissions are adequate, then there is nothing to stop you from accessing other databases. 如果您的权限足够,则没有什么可以阻止您访问其他数据库。

The database in the connection string will give your query the context that is used when you don't specify a database name as part of a table. 如果不将数据库名称指定为表的一部分,则连接字符串中的数据库将为查询提供上下文。 If your query is simply: 如果您的查询很简单:

SELECT * FROM vw_Interactions

then this will run against the database specified in your connection string. 然后它将针对您的连接字符串中指定的数据库运行。

For your case, when using a table with the same name across multiple databases, the default database doesn't matter much, as long as the data access account has permissions that let the query work. 就您而言,在多个数据库中使用具有相同名称的表时,只要数据访问帐户具有允许查询正常运行的权限,默认数据库就没什么大不了的。

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

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