Quantcast
Channel: CodeSection,代码区,SQL Server(mssql)数据库 技术分享 - CodeSec
Viewing all articles
Browse latest Browse all 3160

Import Data from a SQL Server Multidimensional Database to a Tabular Database

$
0
0

By:Daniel Calbimonte || Related Tips:More >Import and Export

Problem

How do you migrate data from a SQL Server Analysis Services (SSAS) Multidimensional database to a Tabular database. Can you provide a step by step example?

Solution

In in this tip, we will show how to import data into a Tabular database from a SSAS Multidimensional database.

Requirements SQL Server 2012 or 2014. In this tip, we are using SQL Server 2014. Download the AdventureWorksDW Database . You have to install a Tabular Instance. For more information about Tabular Installations, refer tothis link The SSDT for Business Intelligence should be installed. Introduction

To get data into a Tabular database, you could import the data directly from the SQL Server tables since most Multidimensional databases process the data from a relational database which is usually a SQL Server database. If you want to import the data to a Tabular database, you could do so by just clicking on the import icon and selecting the tables from the data source which is a straightforward process.

However, there are some cases when the only way to import the data is from the Multidimensional database and this tip covers that situation.

Launch SSDT and go to File > New Project. Go to Analysis Services > Analysis Services Tabular Project.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
In the Tabular model designer, specify the Tabular Instance Name.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
If you want to rename the project, you can right click the project and rename it.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
Press the Import from Data Source icon.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
As you can see, there are a number of Data Sources. You can import from SQL Server, SQL Azure, Microsoft Access, etc.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
In this example, we will import from a Multidimensional Analysis Services Data Source.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
Specify the connection name (it can be any name), the Server name and the database name. In this example, we are using the AdventureWorks Multidimensional Database.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
Specify the credentials to connect to Analysis Services. Make sure the account has permissions.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
When we import data from a Multidimensional database, we need to specify the MDX statement. We could write the MDX statement manually or design the query. We will design the query by pressing the Design... button.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
Drag and drop the Internet Extended Amount from the Internet Sales measures.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
Drag and drop the Customer attributes like Country, State Province, City and Postal Code.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
The query generated will be similar to the following. The query is showing the Internet Extended Amount by different customer properties like the customer geography and postal code.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
By default, it will display an error message. Click on the Error Message to see the details.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
The error message says that the provider MSOLAP is not registered. By default, the Multidimensional provider is not displayed.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
To solve this problem, you need to download the OLE DB provider for Analysis Services from the feature pack. At this time, the latest feature pack available is the Feature Pack for SQL Server 2016 . Download the SQL_AS_OLEDB.msi file (SQL Analysis Services OLE DB). There are 2 installers: one for x86 machines and one for x64 machines. Make sure to install the correct one on your machine. Once you have the SQL_AS_OLEDB provider installed, repeat steps 5 thru 13. If everything is OK, you will receive a success message:
Import Data from a SQL Server Multidimensional Database to a Tabular Database
We now have the customer information in a Tabular database:
Import Data from a SQL Server Multidimensional Database to a Tabular Database
Just to test, add a new column by double clicking in the add column.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
We will add a DAX expression. We will calculate the tax of 10% of the Measure Internet Freight.
Import Data from a SQL Server Multidimensional Database to a Tabular Database
We will add the precision of 4 decimal places:
Import Data from a SQL Server Multidimensional Database to a Tabular Database
Conclusion

As you can see, to import data from a Multidimensional database we can use MDX queries. We need to create queries for each dimension and fact table.

To import the data, it is necessary to install the OLE DB Provider for Analysis Services .

Next Steps

For more information, refer to the following links:

32-bit and 64-bit windows: frequently asked questions Import Data (SSAS Tabular) Import from a Multidimensional Data Source (SSAS Tabular)

Last Update: 8/2/2016


Import Data from a SQL Server Multidimensional Database to a Tabular Database
About the author
Import Data from a SQL Server Multidimensional Database to a Tabular Database
Daniel Calbimonte is a Microsoft SQL Server MVP, Microsoft Certified Trainer and Microsoft Certified IT Professional. View all my tips

Related Resources


Viewing all articles
Browse latest Browse all 3160

Trending Articles