<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SQL Fool &#187; Business Intelligence</title>
	<atom:link href="http://sqlfool.com/category/business-intelligence/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqlfool.com</link>
	<description>Adventures in SQL Tuning - a blog for the rest of us</description>
	<lastBuildDate>Wed, 02 Nov 2011 20:39:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How To Estimate Data Utilization</title>
		<link>http://sqlfool.com/2011/10/how-to-estimate-data-utilization/</link>
		<comments>http://sqlfool.com/2011/10/how-to-estimate-data-utilization/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 19:11:12 +0000</pubDate>
		<dc:creator>Michelle Ufford</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[SQL 2008]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[Syndication]]></category>
		<category><![CDATA[T-SQL Scripts]]></category>
		<category><![CDATA[DMV]]></category>
		<category><![CDATA[indexes]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[TSQL]]></category>

		<guid isPermaLink="false">http://sqlfool.com/?p=1578</guid>
		<description><![CDATA[Recently, on a conference call presenting data growth rates and database capacity projections, I had a top-line executive ask, "But how much of that data are we actually using today?" The question was met with silence; unless you have rigorous auditing in place -- and kudos to you if you do -- it's a difficult [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, on a conference call presenting data growth rates and database capacity projections, I had a top-line executive ask, "But how much of that data are we actually <em>using</em> today?"  The question was met with silence; unless you have rigorous auditing in place -- and kudos to you if you do -- it's a difficult question to answer.  But it begs the question, is there some way to gleam this information from SQL Server?  I think the answer is "yes," if you make some assumptions and understand what you're looking at.  </p>
<p>SQL Server collects stats about every time an index is used and how it is used (i.e. whether a user seeked or scanned the index, etc.).  It also provides a DMV to view these stats: <a href="http://msdn.microsoft.com/en-us/library/ms188755.aspx" target="_blank">sys.dm_db_index_usage_stats</a>.</p>
<p>This DMV provides a wealth of great information, but to answer our question of "What data is actually being used?", we have to refine our criteria.  Are we talking in terms of table counts or data size?  I'd argue that data size is more important than table counts; one unqueried millow-row table is more wasteful than a hundred ten-row tables.  </p>
<p>Also, are we looking at indexes or content?  From a database perspective, I'm more interested in indexes: how much space are we wasting on unused indexes?  To identify this, I need to look at the activity on each individual index.</p>
<p>From a business perspective, I would be more interested in content (i.e. tables): how much business information is being stored that no one is even looking at?  To answer this question, I need to roll up all index usage to see if *any* of the indexes on a table were used.  Since both were of interest to me, I decided to write queries to answer both questions.  </p>
<p>Lastly, we need to understand the flaws with this data.  Chiefly, I cannot tell whether a user requested one row from a million-row table, or if [s]he needed all of the data in the table.  This is a pretty important issue, especially with large historical data stores, and it's where I have to make the biggest assumption: if even one person looked at one row in the table, I count all pages in the table as having been accessed.  </p>
<p>Now, you may make different decisions than I did above, and that's fine... each environment and project has different needs.  But these assumptions are very important to understanding the output of the query below:</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">USE</span> master;
GO
&nbsp;
<span style="color: #008080;">/* 
    This will give you an approximation of how much data is being utilized on a server.
    Since the data is only valid as of the last server reboot, we should start off with
    an idea of how much data we've accrued.  
*/</span>
&nbsp;
<span style="color: #008080;">/* Find out when the server was last rebooted */</span>
<span style="color: #008080;">-- 2008</span>
<span style="color: #0000FF;">SELECT</span> sqlserver_start_time <span style="color: #0000FF;">FROM</span> sys.<span style="color: #202020;">dm_os_sys_info</span>;
<span style="color: #008080;">-- 2005</span>
<span style="color: #0000FF;">SELECT</span> create_date <span style="color: #0000FF;">FROM</span> sys.<span style="color: #202020;">databases</span> <span style="color: #0000FF;">WHERE</span> name <span style="color: #808080;">=</span> <span style="color: #FF0000;">'tempdb'</span>;
&nbsp;
&nbsp;
<span style="color: #008080;">/* Create a temporary table to hold our data, since we're going to iterate through databases */</span>
<span style="color: #0000FF;">IF</span> <span style="color: #FF00FF;">OBJECT_ID</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'tempdb..#Results'</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">IS</span> <span style="color: #808080;">NOT</span> <span style="color: #808080;">NULL</span>
    <span style="color: #0000FF;">DROP</span> <span style="color: #0000FF;">TABLE</span> #Results;
&nbsp;
<span style="color: #0000FF;">CREATE</span> <span style="color: #0000FF;">TABLE</span> #Results
<span style="color: #808080;">&#40;</span>
      databaseName  <span style="color: #0000FF;">NVARCHAR</span><span style="color: #808080;">&#40;</span><span style="color: #000;">128</span><span style="color: #808080;">&#41;</span>
    , tableName     <span style="color: #0000FF;">NVARCHAR</span><span style="color: #808080;">&#40;</span><span style="color: #000;">128</span><span style="color: #808080;">&#41;</span>
    , indexID       <span style="color: #0000FF;">INT</span>
    , records       <span style="color: #0000FF;">BIGINT</span>
    , activity      <span style="color: #0000FF;">BIGINT</span>
    , totalPages    <span style="color: #0000FF;">BIGINT</span>
<span style="color: #808080;">&#41;</span>;
&nbsp;
<span style="color: #008080;">/*  
    sp_foreachdb was written by SQL MVP Aaron Bertrand and can be downloaded 
    at http://www.mssqltips.com/sqlservertip/2201/making-a-more-reliable-and-flexible-spmsforeachdb/
    Alternatively, you can also use sys.sp_MSforeachdb
*/</span>
<span style="color: #008080;">--EXECUTE master.dbo.sp_foreachdb</span>
<span style="color: #0000FF;">EXECUTE</span> sys.<span style="color: #202020;">sp_MSforeachdb</span>
<span style="color: #FF0000;">'   USE ?; 
&nbsp;
    -- You can gleam a lot of information about historical data usage from partitions
    -- but for now, we will just roll up any partitions we may have
    WITH myCTE AS
    (
        SELECT p.[object_id] AS objectID
            , p.index_id
            , SUM(p.[rows]) AS records
            , SUM(au.total_pages) AS totalPages
        FROM sys.partitions AS p WITH (NOLOCK)
        JOIN sys.allocation_units AS au WITH (NOLOCK)
            ON p.hobt_id = au.container_id
        GROUP BY p.[object_id] 
            , p.index_id
    )
&nbsp;
    -- Grab all tables and join to our usage stats DMV
    INSERT INTO #Results
    SELECT DB_NAME() AS databaseName
        , t.name
        , x.index_id
        , MAX(x.records) AS records
        , ISNULL(SUM(us.user_lookups + us.user_scans + us.user_seeks), 0) AS activity
        , SUM(x.totalPages) AS totalPages
    FROM sys.tables AS t WITH (NOLOCK)
    JOIN myCTE AS x
        ON t.[object_id] = x.objectID
    LEFT JOIN sys.dm_db_index_usage_stats AS us WITH (NOLOCK)
        ON us.[object_id] = x.objectID
        AND us.index_id = x.index_id
        AND us.database_id = DB_ID()
    GROUP BY t.name
    , x.index_id;'</span>
&nbsp;
<span style="color: #008080;">/* Because we're looping through databases, make sure we're not missing any major ones */</span>
<span style="color: #0000FF;">SELECT</span> <span style="color: #808080;">*</span> <span style="color: #0000FF;">FROM</span> sys.<span style="color: #202020;">databases</span> <span style="color: #0000FF;">WHERE</span> name <span style="color: #808080;">NOT</span> <span style="color: #808080;">IN</span> <span style="color: #808080;">&#40;</span><span style="color: #0000FF;">SELECT</span> databaseName <span style="color: #0000FF;">FROM</span> #Results<span style="color: #808080;">&#41;</span>;
&nbsp;
<span style="color: #008080;">/* Retrieve actual % data utilization, which is performed at the index level */</span>
<span style="color: #0000FF;">SELECT</span> databaseName
    , <span style="color: #FF00FF;">SUM</span><span style="color: #808080;">&#40;</span>queriedPages<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> TotalQueriedPages
    , <span style="color: #FF00FF;">SUM</span><span style="color: #808080;">&#40;</span>totalPages<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> TotalPages
    , <span style="color: #0000FF;">CAST</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">SUM</span><span style="color: #808080;">&#40;</span>queriedPages<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> <span style="color: #0000FF;">FLOAT</span><span style="color: #808080;">&#41;</span> <span style="color: #808080;">/</span> <span style="color: #FF00FF;">REPLACE</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">SUM</span><span style="color: #808080;">&#40;</span>totalPages<span style="color: #808080;">&#41;</span>, <span style="color: #000;">0</span>, <span style="color: #000;">1</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> <span style="color: #FF0000;">'%DataUtil'</span>
<span style="color: #0000FF;">FROM</span> <span style="color: #808080;">&#40;</span>
    <span style="color: #0000FF;">SELECT</span> databaseName
        , tableName
        , indexID
        , <span style="color: #0000FF;">CASE</span> <span style="color: #008080;">-- If we have any activity at all on an index, count it as activity</span>
            <span style="color: #0000FF;">WHEN</span> activity <span style="color: #808080;">=</span> <span style="color: #000;">0</span> <span style="color: #0000FF;">THEN</span> <span style="color: #000;">0.0</span>
            <span style="color: #0000FF;">ELSE</span> totalPages
          <span style="color: #0000FF;">END</span> <span style="color: #0000FF;">AS</span> queriedPages
        , totalPages
    <span style="color: #0000FF;">FROM</span> #Results
    <span style="color: #0000FF;">WHERE</span> databaseName <span style="color: #808080;">NOT</span> <span style="color: #808080;">IN</span> <span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'master'</span>, <span style="color: #FF0000;">'tempdb'</span>, <span style="color: #FF0000;">'msdb'</span>, <span style="color: #FF0000;">'model'</span><span style="color: #808080;">&#41;</span>
<span style="color: #808080;">&#41;</span> x
<span style="color: #0000FF;">GROUP</span> <span style="color: #0000FF;">BY</span> databaseName
<span style="color: #0000FF;">ORDER</span> <span style="color: #0000FF;">BY</span> databaseName;
&nbsp;
<span style="color: #008080;">/* Retrieve % content utilization, which is performed at the table level */</span>
<span style="color: #0000FF;">SELECT</span> databaseName
    , <span style="color: #FF00FF;">SUM</span><span style="color: #808080;">&#40;</span>queriedPages<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> TotalQueriedPages
    , <span style="color: #FF00FF;">SUM</span><span style="color: #808080;">&#40;</span>totalPages<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> TotalPages
    , <span style="color: #0000FF;">CAST</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">SUM</span><span style="color: #808080;">&#40;</span>queriedPages<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> <span style="color: #0000FF;">FLOAT</span><span style="color: #808080;">&#41;</span> <span style="color: #808080;">/</span> <span style="color: #FF00FF;">REPLACE</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">SUM</span><span style="color: #808080;">&#40;</span>totalPages<span style="color: #808080;">&#41;</span>, <span style="color: #000;">0</span>, <span style="color: #000;">1</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> <span style="color: #FF0000;">'%ContentUtil'</span>
<span style="color: #0000FF;">FROM</span> <span style="color: #808080;">&#40;</span>
    <span style="color: #0000FF;">SELECT</span> databaseName
        , tableName
        , <span style="color: #FF00FF;">MAX</span><span style="color: #808080;">&#40;</span>records<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> records
        , <span style="color: #0000FF;">CASE</span> <span style="color: #0000FF;">WHEN</span> <span style="color: #FF00FF;">SUM</span><span style="color: #808080;">&#40;</span>activity<span style="color: #808080;">&#41;</span> <span style="color: #808080;">&gt;</span> <span style="color: #000;">0</span> <span style="color: #0000FF;">THEN</span> <span style="color: #FF00FF;">SUM</span><span style="color: #808080;">&#40;</span>totalPages<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">ELSE</span> <span style="color: #000;">0</span> <span style="color: #0000FF;">END</span> <span style="color: #0000FF;">AS</span> queriedPages
        , <span style="color: #FF00FF;">SUM</span><span style="color: #808080;">&#40;</span>totalPages<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> totalPages
    <span style="color: #0000FF;">FROM</span> #Results
    <span style="color: #0000FF;">WHERE</span> databaseName <span style="color: #808080;">NOT</span> <span style="color: #808080;">IN</span> <span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'master'</span>, <span style="color: #FF0000;">'tempdb'</span>, <span style="color: #FF0000;">'msdb'</span>, <span style="color: #FF0000;">'model'</span><span style="color: #808080;">&#41;</span>
    <span style="color: #0000FF;">GROUP</span> <span style="color: #0000FF;">BY</span> databaseName
        , tableName
<span style="color: #808080;">&#41;</span> x
<span style="color: #0000FF;">GROUP</span> <span style="color: #0000FF;">BY</span> databaseName
<span style="color: #0000FF;">ORDER</span> <span style="color: #0000FF;">BY</span> databaseName;</pre></div></div>

<p>Results:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">databaseName               TotalQueriedPages   TotalPages           %DataUtil
-------------------------- ------------------- -------------------- ----------------------
Database1 		   127618701           130607247            0.969619893356378
Database2 		   567188              1614958              0.351209133612143
Database3 		   34269036            34579469             0.991022620966216
Database4 		   137970594           170733391            0.803399928206158
Database5 		   74632930            101543575            0.66909214627557
Database6 		   55809933            72884205             0.765734157938039
Database7 		   560810026           620609815            0.902175272517656
&nbsp;
databaseName               TotalQueriedPages   TotalPages           %ContentUtil
-------------------------- ------------------- -------------------- ----------------------
Database1 		   127763715           130607247            0.970721679051682
Database2 		   571125              1614958              0.353646967908763
Database3 		   34269036            34579469             0.991022620966216
Database4 		   137970921           170733391            0.803399928206158
Database5 		   96144726            101543575            0.861947682777784
Database6 		   72269666            72884205             0.991568146820268
Database7 		   620525938           620609815            0.998240279711804</pre></div></div>

<p>The first result set examines the utilization of indexes, and the second result set examines the utilization of data at the content (table) level.  For example, if we look at Database6, we'll see that we are only utilizing 77% of our indexes, but we're looking at 99% of our table data.  So this is a good indicator that we have some unused indexes to clean up in that database.  </p>
<p>Know a better way to answer this question using SQL Server DMV's?  Please leave me a comment so I can learn from your experience.  <img src='http://sqlfool.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>In unrelated news, this may be my last blog post for a little while.  I'm due with my second child a week from today and expect all of my free time to be consumed by him for a little while.  That and, quite frankly, I do not trust myself near a computer, especially a database, in such a sleep-deprived state.  <img src='http://sqlfool.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://sqlfool.com/2011/10/how-to-estimate-data-utilization/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Yet Another PASS Summit Recap &amp; Thoughts on PDW</title>
		<link>http://sqlfool.com/2010/11/yet-another-pass-summit-recap/</link>
		<comments>http://sqlfool.com/2010/11/yet-another-pass-summit-recap/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 15:43:10 +0000</pubDate>
		<dc:creator>Michelle Ufford</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[PASS]]></category>
		<category><![CDATA[SQL 2008]]></category>
		<category><![CDATA[Syndication]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[bi]]></category>
		<category><![CDATA[data warehouse]]></category>
		<category><![CDATA[parallel data warehouse]]></category>
		<category><![CDATA[pdw]]></category>
		<category><![CDATA[Summit]]></category>

		<guid isPermaLink="false">http://sqlfool.com/?p=1427</guid>
		<description><![CDATA[The SQL blogosphere has been lit up with PASS Summit recaps. I debated about whether or not to write my own post, until I remembered that this blog serves as a mini-journal for me too. I have a notoriously poor memory--my husband likes to say that my CPU and memory are good, but I must [...]]]></description>
			<content:encoded><![CDATA[<p>The SQL blogosphere has been <a href="http://www.sqlmusings.com/2010/11/10/pass-summit-day-1-keynote-mcm-sqlpasstv-servicebroker-bi-power-hour-mdx-who-dunnit/" target="_blank">lit</a> <a href="http://cwebbbi.wordpress.com/2010/11/10/pass-summit-2010-day-1/" target="_blank">up</a> <a href="http://www.sqlservercentral.com/blogs/kathi_kellenberger/archive/2010/11/15/pass-report-1-why-you-should-have-been-there.aspx" target="_blank">with</a> <a href="http://blogs.lessthandot.com/index.php/ITProfessionals/ProfessionalDevelopment/sql-pass-2010" target="_blank">PASS</a> <a href="http://www.sqlservercentral.com/blogs/stratesql/archive/2010/11/15/david-dewitt-at-the-pass-summit.aspx" target="_blank">Summit</a> <a href="http://www.sqlservercentral.com/blogs/sqlchicken/archive/2010/11/15/pass-summit-magic_3A00_-the-turn.aspx" target="_blank">recaps</a>.</p>
<p>I debated about whether or not to write my own post, until I remembered that this blog serves as a mini-journal for me too.  I have a notoriously poor memory--my husband likes to say that my CPU and memory are good, but I must have an unusual clustering strategy--so maybe this blog post will be a good pointer for me when I start prepping for next year's Summit.  <img src='http://sqlfool.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>This was definitely the best PASS Summit conference ever.  While there will always be opportunities to do things better--improvement is a never-ending process--it was clear that the organizers of this event listened to the feedback they had received the previous year.  One of the best changes?  Backpacks.  These were very useful, as evidenced by their presence everywhere.  Nice job, organizers!</p>
<p>My absolute favorite thing about Summit is the chance to meet and reconnect with so many amazing SQL folks.  There were entirely too many people to list out, but some highlights include meeting <a href="http://twitter.com/crysmanson">Crys Manson</a>, <a href="http://twitter.com/sqlchicken">Jorge Segarra</a>, and <a href="http://twitter.com/datachick">Karen Lopez</a> for the first time.  I also had a chance encounter with <a href="http://ola.hallengren.com/" target="_blank">Ola Hallengren</a> in the Sheraton elevator.  Apparently we were only staying a few rooms apart this year.  We ended up having a couple of really great discussions about index fragmentation, the differences between our scripts, and things we'd like to see changed in future releases of SQL Server.  </p>
<p>I had the opportunity to sit on the panel at the WIT luncheon.  All of the women on the panel were amazing, and I was honored just to be sitting at the same table as them.  I was especially pleased to meet Nora Denzel, a Senior Vice President at Intuit.  Intelligent, confident, and witty, she is a great role model for young technical women, myself included.  I can only hope that some of her gumption rubbed off on me due to our close proximity.  <img src='http://sqlfool.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   After the event, I was pleasantly surprised by how many folks--men and women both--came up to me to tell me how much they enjoyed it.  Thanks to the WIT VC for organizing another great event!</p>
<p>The lightning talk sessions were a new feature this year, and I think I like it.  The format of the lightning session is 7 speakers presenting on a topic for 5 quick minutes.  Watching these sessions is kind of like skipping right to the center of a tootsie pop: all content and no fluff.  The standout lightning talk presentation for me was <a href="http://sqlblog.com/blogs/adam_machanic/" target="_blank">Adam Machanic's</a>.  It was beautifully rehearsed and choreographed.  Nice job, Adam!</p>
<p>Another of the many highlights of the week was meeting the Microsoft execs.  In addition to meeting Ted Kummert, Mark Souza, and Donald Farmer--all very nice gentlemen--I had the opportunity to speak at length with Jose Blakely about Parallel Data Warehouse (PDW).  PDW, formerly codenamed Madison, was officially launched at Summit.  Jose was kind enough to explain the PDW architecture, both where it came from and the vision for where it's going.  I'd attempt to regurgitate it here, but I think the probability of me misquoting would be high.  </p>
<p>Suffice it to say, this technology has me excited.  Why?  Quite frankly, I think PDW will do for data warehousing what SQL Server did for databases, and what Analysis Services did for BI: make it affordable.  With a compelling cost-per-terabyte, an attractive scale-out approach, and an entry point at under $1 million, we'll see more small-to-midsized companies implementing data warehousing and business intelligence.  This is good news for those of us looking for an affordable data warehouse solution and for those of us who make our living with SQL Server.  And for those of you who might suggest that few companies need a datawarehouse that can support multi-terabyte data, I'd like to point out that just 3 or 4 years ago, 100 GB was considered a lot of data.  </p>
<p>I spent most of my week digging into the PDW architecture.  It's not all roses--it's a first release and, as such, is immature compared to the much older and more established data warehouse systems--but again, it has a lot going for it, not least of all it's easy integration within a SQL Server environment and the relatively low cost.  We're currently investigating this as a possible data warehouse solution for our business intelligence environment, so expect to see more from me about PDW as I learn more about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlfool.com/2010/11/yet-another-pass-summit-recap/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Why I&#8217;m Blogging Less</title>
		<link>http://sqlfool.com/2009/10/why-im-blogging-less/</link>
		<comments>http://sqlfool.com/2009/10/why-im-blogging-less/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 14:50:35 +0000</pubDate>
		<dc:creator>Michelle Ufford</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[PASS]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Syndication]]></category>
		<category><![CDATA[380PASS]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[SQL Saturday]]></category>

		<guid isPermaLink="false">http://sqlfool.com/?p=1174</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p><strong>East Iowa SQL Saturday:</strong></p>
<p>I'm the event organizer for <a href="http://sqlsaturday.380pass.org" target="_blank">East Iowa SQL Saturday</a>, 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.</p>
<p>We're very fortunate to have snagged an excellent set of speakers.  <a href="http://jessicammoss.blogspot.com/" target="_blank">Jessica Moss</a>, <a href="http://sqlblog.com/blogs/louis_davidson/default.aspx" target="_blank">Louis Davidson</a>, <a href="http://www.ford-it.com/sqlagentman/" target="_blank">Timothy Ford</a>, <a href="http://stratesql.com/" target="_blank">Jason Strate</a>, and <a href="http://www.simple-talk.com/author/alex-kuznetsov/" target="_blank">Alex Kuznetsov</a> are just a few of the great speakers we have lined up.</p>
<p style="text-align: left;">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 <a href="http://sqlsaturday.380pass.org" target="_blank">http://sqlsaturday.380pass.org</a>.</p>
<p><strong>The Other Reason:</strong></p>
<p><a href="http://sqlfool.com/wp-content/uploads/2009/10/baby_uff.jpg"><img class="aligncenter size-medium wp-image-1177" title="baby_uff" src="http://sqlfool.com/wp-content/uploads/2009/10/baby_uff-300x219.jpg" alt="baby_uff" width="300" height="219" /></a></p>
<p>Yes, that's right, I'm with child.  Expecting.  Eating for two.  Bun in the oven.  In the family way.  You get the idea.</p>
<p>So when I'm not at work, planning SQL Saturday, or playing <a href="http://www.civilizationrevolution.com/" target="_blank">Civilization Revolution</a>, I'm sleeping.  For those who remotely care, I'm due around Super Bowl time in February 2010.  </p>
<div class="wp-caption aligncenter" style="width: 310px"><img alt="2010: The Year I Make Contact" src="http://www.thespacereview.com/archive/1310a.jpg" title="2010: The Year I Make Contact" width="80%" height="80%" /><p class="wp-caption-text">2010: The Year I Make Contact</p></div>
<p>Rest assured, this blog isn't going away.  And hopefully once I get through <a href="http://sqlsaturday.380pass.org" target="_blank">SQL Saturday</a> and then <a href="http://summit2009.sqlpass.org" target="_blank">PASS Summit</a>, I'll have more free time again.  <img src='http://sqlfool.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://sqlfool.com/2009/10/why-im-blogging-less/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Getting Started with Variables in SSIS</title>
		<link>http://sqlfool.com/2009/08/getting-started-with-variables-in-ssis/</link>
		<comments>http://sqlfool.com/2009/08/getting-started-with-variables-in-ssis/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 13:13:51 +0000</pubDate>
		<dc:creator>Michelle Ufford</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Syndication]]></category>
		<category><![CDATA[bi]]></category>
		<category><![CDATA[BIDS]]></category>
		<category><![CDATA[SSIS]]></category>

		<guid isPermaLink="false">http://sqlfool.com/?p=1134</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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:</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">Use</span> AdventureWorks;
Go
&nbsp;
<span style="color: #0000FF;">Create</span> <span style="color: #0000FF;">Procedure</span> dbo.<span style="color: #202020;">LastOrderGet_sp</span>
<span style="color: #0000FF;">As</span>
<span style="color: #0000FF;">Set</span> <span style="color: #0000FF;">NoCount</span> <span style="color: #0000FF;">On</span>;
<span style="color: #0000FF;">Begin</span>
&nbsp;
    <span style="color: #0000FF;">Select</span> <span style="color: #FF00FF;">Max</span><span style="color: #808080;">&#40;</span>SalesOrderID<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">As</span> <span style="color: #FF0000;">'LastSalesOrderID'</span>
    <span style="color: #0000FF;">From</span> AdventureWorks.<span style="color: #202020;">Sales</span>.<span style="color: #202020;">SalesOrderHeader</span> <span style="color: #0000FF;">With</span> <span style="color: #808080;">&#40;</span>NoLock<span style="color: #808080;">&#41;</span>
&nbsp;
    <span style="color: #0000FF;">Set</span> <span style="color: #0000FF;">NoCount</span> <span style="color: #0000FF;">Off</span>;
    <span style="color: #0000FF;">Return</span> <span style="color: #000;">0</span>;
<span style="color: #0000FF;">End</span>
Go
&nbsp;
<span style="color: #0000FF;">Create</span> <span style="color: #0000FF;">Procedure</span> dbo.<span style="color: #202020;">ProcessLastOrder_sp</span>
    @LastOrderID <span style="color: #0000FF;">int</span>
<span style="color: #0000FF;">As</span>
<span style="color: #0000FF;">Set</span> <span style="color: #0000FF;">NoCount</span> <span style="color: #0000FF;">On</span>;
<span style="color: #0000FF;">Begin</span>
&nbsp;
    <span style="color: #0000FF;">Select</span> SalesOrderDetailID
        , ProductID
        , OrderQty
        , LineTotal
    <span style="color: #0000FF;">From</span> AdventureWorks.<span style="color: #202020;">Sales</span>.<span style="color: #202020;">SalesOrderDetail</span> <span style="color: #0000FF;">With</span> <span style="color: #808080;">&#40;</span>NoLock<span style="color: #808080;">&#41;</span>
    <span style="color: #0000FF;">Where</span> SalesOrderID <span style="color: #808080;">=</span> @LastOrderID;
&nbsp;
    <span style="color: #0000FF;">Set</span> <span style="color: #0000FF;">NoCount</span> <span style="color: #0000FF;">Off</span>;
    <span style="color: #0000FF;">Return</span> <span style="color: #000;">0</span>;
<span style="color: #0000FF;">End</span>
Go
&nbsp;
<span style="color: #0000FF;">Create</span> <span style="color: #0000FF;">Table</span> dbo.<span style="color: #202020;">testStage</span>
<span style="color: #808080;">&#40;</span>
      SalesOrderDetailID    <span style="color: #0000FF;">int</span>
    , ProductId             <span style="color: #0000FF;">int</span>
    , OrderQty              <span style="color: #0000FF;">smallint</span>
    , LineTotal             <span style="color: #0000FF;">numeric</span>
<span style="color: #808080;">&#41;</span>;
Go</pre></div></div>

<p>Now for the fun stuff!  </p>
<p><em>(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).</em></p>
<p>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 <strong>View</strong> --> <strong>Other Windows</strong> --> <strong>Variables</strong>.</p>
<div class="wp-caption alignnone" style="width: 632px"><a href="http://sqlfool.com/blogImages/20090824/SSIS_variable_01.jpg"><img alt="Open Variables Window" src="http://sqlfool.com/blogImages/20090824/SSIS_variable_01.jpg" title="Open Variables Window" width="80%" height="80%" /></a><p class="wp-caption-text">Open Variables Window</p></div>
<p>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 <strong>LastSalesOrderID</strong>.</p>
<div class="wp-caption alignnone" style="width: 414px"><a href="http://sqlfool.com/blogImages/20090824/SSIS_variable_02.jpg"><img alt="Create a variable" src="http://sqlfool.com/blogImages/20090824/SSIS_variable_02.jpg" title="Create a variable" width="404" height="203" /></a><p class="wp-caption-text">Create a variable</p></div>
<p>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.</p>
<p><em>(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.)</em></p>
<div class="wp-caption alignnone" style="width: 646px"><a href="http://sqlfool.com/blogImages/20090824/SSIS_variable_03.jpg"><img alt="Create Execute SQL Task" src="http://sqlfool.com/blogImages/20090824/SSIS_variable_03.jpg" title="Create Execute SQL Task" width="80%" height="80%" /></a><p class="wp-caption-text">Create Execute SQL Task</p></div>
<p>Double-click on your Execute SQL Task and configure with the following values:</p>
<ul>
<li>Set "Result Set" to <strong>Single Row</strong>.</li>
<li>Set your Connection to your appropriate data source.</li>
<li>Set your SQL Statement to: <strong>Execute AdventureWorks.dbo.LastOrderGet_sp;</strong></li>
</ul>
<div class="wp-caption alignnone" style="width: 635px"><a href="http://sqlfool.com/blogImages/20090824/SSIS_variable_04.jpg"><img alt="Set up your Execute SQL Task" src="http://sqlfool.com/blogImages/20090824/SSIS_variable_04.jpg" title="Set up your Execute SQL Task" width="80%" height="80%" /></a><p class="wp-caption-text">Set up your Execute SQL Task</p></div>
<p>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 <strong>LastSalesOrderID</strong>.  Click on the Variable Name column and scroll down until you find the appropriate one (<strong>User::LastSalesOrderID</strong>).</p>
<div class="wp-caption alignnone" style="width: 592px"><a href="http://sqlfool.com/blogImages/20090824/SSIS_variable_05.jpg"><img alt="Mapping the results to a variable" src="http://sqlfool.com/blogImages/20090824/SSIS_variable_05.jpg" title="Mapping the results to a variable" width="582" height="563" /></a><p class="wp-caption-text">Mapping the results to a variable</p></div>
<p>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.  </p>
<div class="wp-caption alignnone" style="width: 646px"><a href="http://sqlfool.com/blogImages/20090824/SSIS_variable_06.jpg"><img alt="Add Data Flow Task" src="http://sqlfool.com/blogImages/20090824/SSIS_variable_06.jpg" title="Add Data Flow Task" width="80%" height="80%" /></a><p class="wp-caption-text">Add Data Flow Task</p></div>
<p>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:<br />
<strong>Execute AdventureWorks.dbo.ProcessLastOrder_sp ?</strong><br />
The question mark (?) tells SSIS to expect a parameter.  </p>
<div class="wp-caption alignnone" style="width: 660px"><a href="http://sqlfool.com/blogImages/20090824/SSIS_variable_07.jpg"><img alt="Edit OLE DB Source" src="http://sqlfool.com/blogImages/20090824/SSIS_variable_07.jpg" title="Edit OLE DB Source" width="80%" height="80%" /></a><p class="wp-caption-text">Edit OLE DB Source</p></div>
<p>Now click on the Parameters button on the left.  This is where we map our variable to our parameter.  For the "Parameters" value, enter <strong>@LastOrderID</strong> (the parameter the stored procedure is expecting).  In the "Variables" column, click on the drop-down and navigate to the <strong>User::LastSalesOrderID</strong> variable. </p>
<div class="wp-caption alignnone" style="width: 406px"><a href="http://sqlfool.com/blogImages/20090824/SSIS_variable_08.jpg"><img alt="Map Variables to Parameters" src="http://sqlfool.com/blogImages/20090824/SSIS_variable_08.jpg" title="Map Variables to Parameters" width="396" height="411" /></a><p class="wp-caption-text">Map Variables to Parameters</p></div>
<p>Finally, set up an OLE DB Destination, and configure the OLE DB Source to load into the testStage table.  </p>
<div class="wp-caption alignnone" style="width: 660px"><a href="http://sqlfool.com/blogImages/20090824/SSIS_variable_09.jpg"><img alt="Configure OLE DB Destination" src="http://sqlfool.com/blogImages/20090824/SSIS_variable_09.jpg" title="Configure OLE DB Destination" width="80%" height="80%" /></a><p class="wp-caption-text">Configure OLE DB Destination</p></div>
<p>At this point, you should be able to successfully execute your package.  Upon successful execution, the testStage table will return the following results:</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">Select</span> <span style="color: #808080;">*</span> <span style="color: #0000FF;">From</span> testStage;
&nbsp;
SalesOrderDetailID ProductId   OrderQty LineTotal
<span style="color: #008080;">------------------ ----------- -------- ------------------</span>
<span style="color: #000;">121315</span>             <span style="color: #000;">878</span>         <span style="color: #000;">1</span>        <span style="color: #000;">21</span>
<span style="color: #000;">121316</span>             <span style="color: #000;">879</span>         <span style="color: #000;">1</span>        <span style="color: #000;">159</span>
<span style="color: #000;">121317</span>             <span style="color: #000;">712</span>         <span style="color: #000;">1</span>        <span style="color: #000;">8</span></pre></div></div>

<p>That's all for now.  Hopefully this gives you an idea of how easy and useful it is to work with variables in SSIS.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlfool.com/2009/08/getting-started-with-variables-in-ssis/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Max Parallelism on Cube Processing</title>
		<link>http://sqlfool.com/2009/07/max-parallelism-on-cube-processing/</link>
		<comments>http://sqlfool.com/2009/07/max-parallelism-on-cube-processing/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 15:00:35 +0000</pubDate>
		<dc:creator>Michelle Ufford</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[Syndication]]></category>
		<category><![CDATA[bi]]></category>
		<category><![CDATA[cubes]]></category>
		<category><![CDATA[OLAP]]></category>
		<category><![CDATA[SSAS]]></category>

		<guid isPermaLink="false">http://sqlfool.com/?p=1108</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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.  </p>
<p>When processing a cube, click on "Change Settings..."</p>
<div id="attachment_1109" class="wp-caption aligncenter" style="width: 267px"><a href="http://sqlfool.com/wp-content/uploads/2009/07/20090720_parallelism1.jpg"><img src="http://sqlfool.com/wp-content/uploads/2009/07/20090720_parallelism1-257x300.jpg" alt="SSAS Cube Processing" title="20090720_parallelism1" width="257" height="300" class="size-medium wp-image-1109" /></a><p class="wp-caption-text">SSAS Cube Processing</p></div>
<p>Now change the "Maximum parallel tasks" to 1, 2, or whatever is appropriate for your environment:</p>
<div id="attachment_1110" class="wp-caption aligncenter" style="width: 310px"><a href="http://sqlfool.com/wp-content/uploads/2009/07/20090720_parallelism2.jpg"><img src="http://sqlfool.com/wp-content/uploads/2009/07/20090720_parallelism2-300x192.jpg" alt="SSAS Cube Processing Settings" title="20090720_parallelism2" width="300" height="192" class="size-medium wp-image-1110" /></a><p class="wp-caption-text">SSAS Cube Processing Settings</p></div>
<p>That's all there is to it.  Happy cube processing!</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlfool.com/2009/07/max-parallelism-on-cube-processing/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hello (BI) World!</title>
		<link>http://sqlfool.com/2009/07/hello-bi-world/</link>
		<comments>http://sqlfool.com/2009/07/hello-bi-world/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 23:13:43 +0000</pubDate>
		<dc:creator>Michelle Ufford</dc:creator>
				<category><![CDATA[Business Intelligence]]></category>
		<category><![CDATA[bi]]></category>
		<category><![CDATA[OLAP]]></category>
		<category><![CDATA[SQL Resources]]></category>

		<guid isPermaLink="false">http://sqlfool.com/?p=1104</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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).  </p>
<p>To get started, I'd like to share my current favorite BI resource website:  <a href="http://www.learnmicrosoftbi.com" target="_blank">http://www.learnmicrosoftbi.com</a>.  <a href="http://www.learnmicrosoftbi.com" target="_blank">LearnMicrosoftBI</a> 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.  </p>
<p>Here's a couple of other items of note:</p>
<ul>
<li><a href="http://www.codeplex.com/bidshelper" target="_blank">BIDS Helper</a> on CodePlex</li>
<li>A preview of <a href="http://www.vandeputte.org/2009/07/excel-2010-personal-sneak-preview.html" target="_blank">Excel 2010 features for Analysis Services</a> by <a href="http://www.vandeputte.org" target="_blank">Frederik Vandeputte</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sqlfool.com/2009/07/hello-bi-world/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

