Why I’m Blogging Less

I’ve received a few questions asking why I’ve been blogging less frequently, and even one inquiry after my health. Rest assured, I’m completely fine. But there are 2 perfectly good reasons why I’ve been blogging less these days.

East Iowa SQL Saturday:

I’m the event organizer for East Iowa SQL Saturday, which is eating up a lot of my free time. If you haven’t yet heard about our SQL Saturday event, let me give you a brief overview. It’s a FREE, one-day training event geared toward SQL Server professionals and anyone who wants to learn more about SQL Server. We have 22 sessions planned covering a variety of topics, from Business Intelligence to Disaster Recovery to SQL Server 2008 topics. And if you’re a .NET developer, we also have some .NET-related presentations, including PowerShell and MVC.

We’re very fortunate to have snagged an excellent set of speakers. Jessica Moss, Louis Davidson, Timothy Ford, Jason Strate, and Alex Kuznetsov are just a few of the great speakers we have lined up.

There’s only a handful of spots left, so if you’re interested in attending, you should register soon. To find out more details about the speakers and sessions, or to register, be sure to check out our website at http://sqlsaturday.380pass.org.

The Other Reason:

baby_uff

Yes, that’s right, I’m with child. Expecting. Eating for two. Bun in the oven. In the family way. You get the idea.

So when I’m not at work, planning SQL Saturday, or playing Civilization Revolution, I’m sleeping. For those who remotely care, I’m due around Super Bowl time in February 2010.

2010: The Year I Make Contact

2010: The Year I Make Contact

Rest assured, this blog isn’t going away. And hopefully once I get through SQL Saturday and then PASS Summit, I’ll have more free time again. :)

Getting Started with Variables in SSIS

August 25, 2009 by Michelle Ufford · 9 Comments
Filed under: Business Intelligence, Syndication 

I recently had to create an SSIS package that used variables to pass data between procs, and I thought it would make a good topic for a blog post. There are many scenarios as to the how and why to use variables in SSIS, but we’re going to keep it pretty simple. Let’s assume we have some need to retrieve data from Proc A, pass it to Proc B, and store the results in Table C. First, let’s set up our environment:

USE AdventureWorks;
Go
 
CREATE PROCEDURE dbo.LastOrderGet_sp
AS
SET NOCOUNT ON;
BEGIN
 
    SELECT MAX(SalesOrderID) AS 'LastSalesOrderID'
    FROM AdventureWorks.Sales.SalesOrderHeader WITH (NoLock)
 
    SET NOCOUNT OFF;
    RETURN 0;
END
Go
 
CREATE PROCEDURE dbo.ProcessLastOrder_sp
    @LastOrderID INT
AS
SET NOCOUNT ON;
BEGIN
 
    SELECT SalesOrderDetailID
        , ProductID
        , OrderQty
        , LineTotal
    FROM AdventureWorks.Sales.SalesOrderDetail WITH (NoLock)
    WHERE SalesOrderID = @LastOrderID;
 
    SET NOCOUNT OFF;
    RETURN 0;
END
Go
 
CREATE TABLE dbo.testStage
(
      SalesOrderDetailID    INT
    , ProductId             INT
    , OrderQty              SMALLINT
    , LineTotal             NUMERIC
);
Go

Now for the fun stuff!

(Please note, I’m assuming some basic understanding of SSIS, so I’m skipping the “how to create a project”, etc. stuff and just going to the pertinent parts).

Inside BIDS (Business Intelligence Development Studio), create a new SSIS project and call it what you will. If your Variable window is not already open, open it now by going to View –> Other Windows –> Variables.

Open Variables Window

Open Variables Window

Now let’s create a variable. To do this, click on the little icon in the upper left-hand corner of the Variables window. Name the variable LastSalesOrderID.

Create a variable

Create a variable

After you create the variable, you should now see it in the Variables window. Make sure the scope of the variable is the name of your project, which is “Blog” in my case (for obvious reasons); this means the variable is defined at the package scope. Once you’ve confirmed that the variable exists, create an Execute SQL task.

(Variables in SSIS, like in other programming languages, can have different scopes. For instance, a package scope means the variable can be accessed anywhere within the package, but a variable with a Data Flow scope can only be accessed within the specified Data Flow task.)

Create Execute SQL Task

Create Execute SQL Task

Double-click on your Execute SQL Task and configure with the following values:

  • Set “Result Set” to Single Row.
  • Set your Connection to your appropriate data source.
  • Set your SQL Statement to: Execute AdventureWorks.dbo.LastOrderGet_sp;
Set up your Execute SQL Task

Set up your Execute SQL Task

Now click on “Result Set” and click on “Add.” You’ll want to put the name of the column that’s returned by the proc in the “Result Name” column; in our case, that’ll be LastSalesOrderID. Click on the Variable Name column and scroll down until you find the appropriate one (User::LastSalesOrderID).

Mapping the results to a variable

Mapping the results to a variable

Go ahead and add a Data Flow task to the designer surface. We don’t need to use a Data Flow task here — for example, we could use another Execute SQL task instead — but this will help demonstrate one way to use variables.

Add Data Flow Task

Add Data Flow Task

Double-click on the Data Flow task and add an OLE DB Source, then double-click on it to open up the properties. Enter the following text in the “SQL Command text” window:
Execute AdventureWorks.dbo.ProcessLastOrder_sp ?
The question mark (?) tells SSIS to expect a parameter.

Edit OLE DB Source

Edit OLE DB Source

Now click on the Parameters button on the left. This is where we map our variable to our parameter. For the “Parameters” value, enter @LastOrderID (the parameter the stored procedure is expecting). In the “Variables” column, click on the drop-down and navigate to the User::LastSalesOrderID variable.

Map Variables to Parameters

Map Variables to Parameters

Finally, set up an OLE DB Destination, and configure the OLE DB Source to load into the testStage table.

Configure OLE DB Destination

Configure OLE DB Destination

At this point, you should be able to successfully execute your package. Upon successful execution, the testStage table will return the following results:

SELECT * FROM testStage;
 
SalesOrderDetailID ProductId   OrderQty LineTotal
------------------ ----------- -------- ------------------
121315             878         1        21
121316             879         1        159
121317             712         1        8

That’s all for now. Hopefully this gives you an idea of how easy and useful it is to work with variables in SSIS.

Max Parallelism on Cube Processing

July 22, 2009 by Michelle Ufford · 2 Comments
Filed under: Business Intelligence, Syndication 

The default behavior for processing cubes is to let the server determine how much parallelism to use. Let’s face it, the server must’ve not learned to play nice with others as a kid; as such, it doesn’t always make the best decisions. But fear not, you can help it along.

When processing a cube, click on “Change Settings…”

SSAS Cube Processing

SSAS Cube Processing

Now change the “Maximum parallel tasks” to 1, 2, or whatever is appropriate for your environment:

SSAS Cube Processing Settings

SSAS Cube Processing Settings

That’s all there is to it. Happy cube processing!

Hello (BI) World!

July 20, 2009 by Michelle Ufford · 3 Comments
Filed under: Business Intelligence 

For those who are not already aware, I’ve recently switched to the Business Intelligence team as an OLAP developer. I’m pretty excited about the opportunity to learn more about cubes and data mining, and I’ve decided it’s time to start sharing some of what I’m learning. My initial BI-related blog posts will probably be more entry-level topics as I learn my way around BIDS (Business Intelligence Development Studio).

To get started, I’d like to share my current favorite BI resource website: http://www.learnmicrosoftbi.com. LearnMicrosoftBI is an excellent, FREE website run by Craig Utley. Yes, you heard me right… you have to register, but the site is FREE. There are currently 38 videos on SSAS and BI-related topics, ranging from 7 minutes to 58 minutes long. I haven’t watched them all, but the ones I have watched have been helpful. If you’re trying to learn SSAS, be sure to check this site out.

Here’s a couple of other items of note: