Friday, November 18, 2011

SQL Server Integration Services 2012 Finally Implements a Pivot UI to Emulate Access Crosstab Queries

Microsoft’s Matt Masson (@mattmasson) described The Pivot Transform – Now with UI! in an 11/17/2011 post:

One of the post-CTP3 changes for SSIS in SQL Server 2012 is the addition of a user interface for the Pivot transform. This post walks through the new UI, which can be found in the new RC0 preview release.

Sample Data

For this example, we’ll be pulling data from the AdventureWorks sample database. We’ll be grabbing the total sales of all products in the Accessories category (ProductCategoryID = 4), grouped by year.

image

The data will look something like this:

image

We want the end results to be pivoted to look like this (Total product sales by year):

image

Setting up the Source

Add an OLE DB Source transform, and add a connection manager for the AdventureWorks sample database. Paste in the query to retrieve the total product sales by year:

image

Add a Pivot Transform from the SSIS Toolbox (found under the Other Transforms section by default).

image

Connect the Source to the Pivot transform. Double click the Pivot transform to open its editor.

The Pivot UI shows a sample pivot table at the top of the form, where you configure the Pivot Key (the column to use for values across the “top” of the table), the Set Key (the column to use for values down the “left” of the table), and the Pivot Value (the column to use for the values in the middle). The bottom of the UI is where you configure the pivot key values.

After mapping my columns to the appropriate keys, the UI looks like this:

  • Pivot Key –> Year
  • Set Key –> Product Name
  • Pivot Value –> Total

image

The Pivot transform requires you to enter all of the possible Pivot Key values (so it can create output columns for each one). You can manually enter each key here (in our case, we’d have a value for each year that appears in our data set – 2002, 2003, and 2004). Alternatively, we can click the “Ignore un-matched Pivot Key values” checkbox and run the package as is. The pivot transform will output a log message containing all of the key values that we can then copy and paste into the UI.

  1. Check the “Ignore un-matched Pivot Key values and report them after DataFlow” execution box
  2. Click OK to save the changes to the UI
  3. Run the package in the designer
  4. When the package succeeds, click on the Progress tab
  5. Look for an information log message from the Pivot transform which contains the keys
  6. Right click the message and select Copy Message Text
  7. Click Stop to end the execution
  8. Double click the Pivot transform
  9. Uncheck the Ignore un-matched Pivot Key values checkbox
  10. Paste the Pivot Key values into the bottom text box
  11. Trim the text so that it only contains the key values – “[2002],[2003],[2004]”
  12. Click the Generate Columns Now button

image

The Pivot UI should now look like this:

image

Click OK to save the changes. We’ll add a Row Count transform to the data flow, and connect it to the Pivot’s output. Add a data viewer on the path so we can see the end results.

image

Run the package, and we can see the pivoted results.

image

Access’s Crosstab Wizard is still faster and easier to understand.

Tuesday, November 15, 2011

Steven Thomas Reported Full-featured Access Services Solution at http://www.accesshosting.com on 11/14/2011

imageOur friends at AccessHosting.com are offering free trials of two Access "cloud" solutions. Curious? Here's the deal, from the source.

Offer text provided by AccessHosting.com:

Reporting services for Access Web Databases in SharePoint 2010 now available - Office 365 users looking web based reporting functionality can republish their databases to accesshosting.com and take advantage of a new introductory price for hosted Access 2010 web databases published to SharePoint 2010.

Remote Desktop Services for Access Applications - Looking to move your existing Access 2003, 2007 and 2010 applications into the cloud quickly and easily? Our Remote Desktop solution provides a simple, secure way to connect multiple external and internal users to your Access databases. You can also use this service to deliver legacy Access applications on the iPad and Android powered devices.

Both of these solutions are available as a no obligation 30-day trial for qualified customers. Visit www.accesshosting.com for complete details.

Read Steve’s original post here.

I’ve used AccessHosting’s services for several cloud-based projects. See my following posts: