PowerPivot SQL访问数据库

时间:2018-01-24 21:39:58

标签: sql ms-access union powerpivot

我需要将表连接到当前位于网络驱动器上的6个Access数据库中的PowerPivot。

PowerPivot为我提供了使用SQL代码提取数据的选项,但我没有在网上找到任何语法示例。

基本上想做

SELECT * FROM path [DB01].[TBL01]
UNION
SELECT * FROM path [DB02].[TBL01]
UNION
SELECT * FROM path [DB03].[TBL01]
UNION
SELECT * FROM path [DB04].[TBL01]
UNION
SELECT * FROM path [DB05].[TBL01]
UNION
SELECT * FROM path [DB06].[TBL01]

1 个答案:

答案 0 :(得分:0)

只需在括号中添加路径:

SELECT * FROM [C:\Path\To\DB01.accdb].[TBL01]
UNION
SELECT * FROM [C:\Path\To\DB02.accdb].[TBL01]
UNION
SELECT * FROM [C:\Path\To\DB03.accdb].[TBL01]
UNION
SELECT * FROM [C:\Path\To\DB04.accdb].[TBL01]
UNION
SELECT * FROM [C:\Path\To\DB05.accdb].[TBL01]
UNION
SELECT * FROM [C:\Path\To\DB06.accdb].[TBL01]