By:Rick Dobson || Related Tips: > Reporting Services Development
ProblemMy organization maintains some critical business information in a database on an Oracle 11g server. However, we also have a community of report developers and business analysts who are familiar with generating charts and reports via SQL Server Reporting Services (SSRS) running with SQL Server 2014. Please provide an example of an easy way to generate charts and reports with SSRS for our data in Oracle 11g.
SolutionSSRS does not connect directly to Oracle 11g databases , but you can readily create a linked server from a 64-bit SQL Server, such as 2014, to the 64-bit Oracle 11g database server. A linked server can be used to retrieve data directly from an Oracle 11g server. Navigate tothis URL for detailed instructions on setting up and configuring the linked server. View this other tip for step-by-step instructions on migrating data both ways between SQL Server 2014 and Oracle 11g. Once the data is retrieved from Oracle 11g, you can perform any required processing and then prepare charts and reports with SSRS for data retrieved from Oracle to SQL Server.
To demonstrate the approach in this tip, all steps from populating an Oracle table to retrieving the data to SQL Server, through to generating an SSRS matrix report with a sparkline chart are described. In a practical application, you will typically not have to populate a table in an Oracle database from SQL Server because you would not be using this tip if the data were already in SQL Server.
Overview of ProcessThe tip uses a linked server to an Oracle 11g database to retrieve data to a SQL Server 2014 database. Then, the retrieved data are manipulated for a report. The report shows monthly changes in S&P 500 index prices as well as daily price changes within months across years. The overall monthly change is displayed as a number and the daily price changes are displayed as points in a sparkline chart. The source data for this tip originates from the Yahoo Finance website.
Users can pick a month for which they want the report to display results. The following screen shot displays July 2016 S&P 500 data. The report includes three columns for year, monthly change in price during a selected month, and daily price change within a selected month. Both monthly and daily price changes are dynamically color coded - red for negative change, green for positive change, and black for no change. Additionally, users can display the numeric value for a daily price change via a tooltip. For example, the following report shows a change of .29 for July 13 in 2016 (the thirteenth point on the sparkline for 2016 row).

Downloading S&P historical prices to your computer
The source data used for this tip are historical S&P 500 high-low-open-close-volume data from the Yahoo Finance website. Direct your browser to http://ichart.finance.yahoo.com/table.csv?s=^GSPC&ignore=.csv to download the historical data to a csv file on your computer.
Below is an excerpt from a file downloaded on August 10, 2016. Notice that the data start from the day before the download (August 9, 2016). Each row has a date along with associated data, such as the closing price for the day (Close). The URL returned data going back to January 3, 1950, but the excerpt just shows data back through the beginning of July 2016.
Notice also that not all dates in a month have rows with data. July 2 through July 4 in 2016 do not have rows. The stock market was closed on these dates. July 4 was a holiday, and July 2 and 3 were weekend days when the market is also closed.

Architecture of the SSRS Sparkline Report Tip
After downloading the historical prices from the Yahoo Finance website to a csv file on your computer, there are five remaining data processing steps to configuring the data for this tip. These steps are implemented from an SQL Server Integration Services (SSIS) package named SandPHistoricalPrices.dtsx that resides within the SandPHistoricalPrices SSIS project. You can run the package in the SSIS project to prepare a table referenced by a SSRS project that generates the matrix report with the sparkline chart. The name of the SSRS project is SandP Sparkline Report.
The following screen shot shows a control flow view of the five key data processing steps from within the SandPHistoricalPrices SSIS project.

Here's a brief synopsis of each step. All the steps, except one, are SQL task steps. The Import SandP historical prices step is the lone data flow task step.
Conditionally drop and create data table: This step creates a fresh copy of the SandPHistoricalPrices table which is used for storing downloaded S&P historical data from the Yahoo Finance website Import SandP historical prices step: This step imports the downloaded historical prices from a csv file to a SQL Server table; review this mssqlTips.com tip and the SandPHistoricalPrices SSIS project for additional help on accomplishing this and the next step Transform columns to SQL data types: This step transforms the character data from the imported csv file to SQL Server data types, such as datetime type instead of a character representation of Date column values Copy SQL Server data to Oracle: This step uses a linked server to create a target table in Oracle and then insert data from a SQL Server table with historical prices to an Oracle table Import and Process Oracle data for use with SSRS: This step retrieves data from the Oracle data with historical prices and performs preliminary processing for making the data ready for a matrix report with a sparkline chartThe SourceConnectionFlatFile connection manager references the csv file with historical prices. The DestinationConnectionOLEDB connection manager references the SQL Server and database storing tables to support the SSRS report. For this tip, the database name within SQL Server is set to SandP_sparkline_tip.
Code for Copy SQL Server data to OracleThe T-SQL code for the step that copies S&P 500 historical prices from SQL Server to Oracle appears below. There are three parts of the script.
First, the code invokes an EXEC statement to drop a table in Oracle through the OrclDB linked server. This linked server points to the HR schema of the sample database that installs with Oracle 11g. The DROP TABLE operates under the permissions for the HR user, which must have permission to drop a table in the HR schema within the Oracle database. This tip uses the same linked server established in theprior tip. If the SandPPricesConverted table does not exist in the Oracle database, the command can