Monday, December 13, 2010

Learning SSIS in Under 1 Hour on the SQL Lunch

Don't miss the SQL Lunch tomorrow.
#44-Learning SSIS under 1 hour

Lunch Image

Speaker: Jose Raul Chinchilla

Add To Outlook: Add To Calendar

Meeting URL: https://www.livemeeting.com/cc/usergroups/join?id=FN36T2&role=attend

Date and Time: 12/14/2010 11:30:00 AM CST
BIO: Jose Chinchilla is a Microsoft Certified Database Administrator and Business Intelligence Developer working as a BI consultant for Convergence Consulting Group, a Tampa based full service consulting firm. Jose has12+ years of experience in IT and has focused his career in OLTP and OLAP database design, development and administration and specializes in ETL/ELT, Data Warehousing and Multidimensional Analysis using SQL Server 2008 BI tools. He is also the current president of the Tampa Bay area Business Intelligence User Group and Official PASS Chapter. He is an avid twitterer under the @SQLJoe handle and blogs at http://www.sqljoe.com


Topic: #44-Learning SSIS under 1 hour
Need to know what is the corresponding SSIS transformation or task to a specific T-SQL statement? How do you accomplish Unions, Joins, and Merges in SSIS? How do you do CASE statements in SSIS? How do you group and aggregate data in SSIS? In this session I will cover the some of the most important SSIS control flow and data flow tasks to jump start DBAs and Developers into SSIS with SQL Server 2008-R2. At the end of this interactive demo, you will be able to identify what control flow tasks and data flow transformations can be used in place of T-SQL statements and scripts. I will also cover how to accomplish in SISS: • Basic SELECT, INSERT, DELETE, UPDATE statements • Inner and Outer joins • CAST and CONVERTS • CASE statement • Sorting, Grouping and Aggregate functions (SUM, COUNT, MAX, AVG) • MERGE and Unions • Loops (WHILE)

Talk to you soon,

Patrick Leblanc, SQL Server MVP, founder SQLLunch.com

Tuesday, November 30, 2010

Passing SSRS T-SQL Values to SSRS MDX Parameters

At a recent client engagement we built a SQL Server Reporting Services (SSRS) report with a T-SQL based data source. A requirement of the report was to create an action that drilled-through to another report. No big deal, right? This is SSRS 101. Well, that was until I realized that the parameters that had to be set on the drill-through report were based on MDX queries. I still didn’t think that it would pose a problem and proceeded to configure the textbox Action to go to another report. After I completed the configurations, I ran the report and it DID NOT WORK! Hmmm, what’s wrong?

The first step was to take a look at the parameters on the MDX based report, which revealed very little. I needed to see the source query that provided the data for the parameter. Initially I did not see the data set for the query. Then I realized that when you created parameters using the MDX query builder in SSRS it hid the corresponding data sets. To show them, right-click on the data sets folder and click Show Hidden DataSets. With the data set now visible, I was able to run the query in the designer. The designer revealed a little Golden Nugget of information. There was a column labeled “ParameterValue” as shown in the following figure:

image

This was interesting. It revealed a fully qualified MDX value as the Parameter Value. Therefore, using the traditional method of only selecting the column from the data set as the value to be passed would not work. So I decided to build an expression that would dynamically create values equal to those values in the ParameterValue column of the MDX query result set. The expression can be seen in the following figure:

image

I re-ran the report and clicked the textbox with the action:

image

This directed me to the MDX based report and the parameter was set correctly, which can be seen in the following figure:

image

Happy Days are here again!

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS, founder SQLLunch.com.

Tuesday, November 16, 2010

Handling Type II Dimension with the MERGE Statement

Microsoft attempted to make our lives easier with the Slowly Changing Dimension task in SSIS.  However, as we all know the task has some major performance issues.  So they introduced the MERGE statement.  When I initially started using the MERGE statement I considered it as a great solution to handle Type I dimensions, but I did not consider it as a solution for Type II.  Recently, I was chatting with Brian Knight and he said that the MERGE statement could handle Type II dimensions.  After spending some time with Books Online I realized that you could SELECT the OUTPUT data from the MERGE Statement.  This set up the perfect mechanism for handling a Type II dimension.  This is how I did it.

Running the examples requires the AdventureWorks2008R2 database.  To get started with the explanation run the following script:

USE tempdb


GO


IF(OBJECT_ID('dbo.Product')) IS NOT NULL


    DROP TABLE dbo.Product


GO


CREATE TABLE dbo.Product


(


    ProductID int identity(1,1),


    ProductNumber varchar(50),


    ProductName varchar(100),


    Color varchar(30),


    ListPrice decimal(12,2)


)


GO


 


INSERT INTO dbo.Product


SELECT 


    ProductNumber,


    Name,


    Color,


    ListPrice


FROM AdventureWorks2008R2.Production.Product


 


GO


 


IF(OBJECT_ID('dbo.DimProduct')) IS NOT NULL


    DROP TABLE dbo.DimProduct


GO


CREATE TABLE dbo.DimProduct


(


    ProductSK int identity(1,1),


    ProductAK varchar(50),


    ProductName varchar(100),


    Color varchar(30),


    ListPrice decimal(12,2),


    EffectiveDate datetime,


    ExpirationDate datetime


)


GO


 


INSERT INTO dbo.DimProduct(ProductAK, ProductName, Color, ListPrice, EffectiveDate)


SELECT 


    ProductNumber,


    ProductName,


    Color,


    ListPrice,


    '1/1/1900'


FROM dbo.Product


GO






The above scripts creates an operational Product table and initially loads the data into the DimProduct table.  Now let's assume that ListPrice is a Type II attribute.  In other words, if the ListPrice changes, the current effective row should be expired and a new row should be inserted into the dimension as the effective row.  This new row will contain the changed data.  To simulate a Type II change run the following script:




UPDATE dbo.Product


SET 


    ListPrice = 5.00


WHERE


    ProductNumber IN ('AR-5381','BA-8327')


GO




The script will change the ListPrice for two products in the operational table.  After the updates have been executed, run the following script:




   1:  INSERT INTO dbo.DimProduct(ProductAK, ListPrice, Color, ProductName, EffectiveDate)


   2:  SELECT ProductNumber, ListPrice, Color, ProductName, EffectiveDate


   3:  FROM 


   4:  (


   5:      MERGE dbo.DimProduct dp


   6:      USING dbo.Product p


   7:          ON dp.ProductAK = p.ProductNumber


   8:      WHEN NOT MATCHED THEN


   9:          INSERT (ProductAK, ProductName, Color, ListPrice, EffectiveDate)


  10:          VALUES (p.ProductNumber, p.ProductName, p.Color, p.ListPrice, '1/1/1900')


  11:      WHEN MATCHED 


  12:          AND ExpirationDate IS NULL 


  13:          AND (dp.ListPrice <> p.ListPrice) THEN


  14:          UPDATE


  15:              SET


  16:                  dp.ExpirationDate = convert(datetime, getdate(), 101)


  17:      OUTPUT $Action MergeAction, p.ProductNumber, p.ListPrice, p.Color, p.ProductName, convert(datetime, getdate(), 101) EffectiveDate


  18:  ) MergeOutput


  19:  WHERE


  20:      MergeAction = 'Update';



Let's start the explanation in the inside of the query.  On line 12 the current effective row is identified.  You may need to change this depending on your Type II dimension design patterns.  Your dimensions may use a specific date as the expiration date and you may also include a ActiveFlag bit column.  Then on line 13 I verify that the column specified as a Type II attribute has actually changed.  Finally, on line 16 the row is expired.  Now you may be thinking how are you going to add the new current row for the corresponding expired rows.  That was the same thing I was thinking.



On line 17 I output any of the Inserts or Updates.  In addition, I added a column that acts as the Effective Date.  The thing that I did not know was that you can SELECT the OUTPUT data from the MERGE statement and INSERT it into a table.  This is accomplished in lines 1 and 2.  Essentially, I derived a table from the OUTPUT of the MERGE statement.  Lastly, I included a WHERE clause to ensure that I only inserted the data that was UPDATED.  That pretty much did it.  To verify the changes run the following query:




SELECT *


FROM dbo.DimProduct


WHERE


    ProductAK IN ('AR-5381','BA-8327')




Talk to you soon,



Patrick LeBlanc, SQL Server MPV, MCTS

Monday, November 15, 2010

My SQL PASS Summit Adventures part 1

I started my PASS Summit a little early this year.  I arrived in Seattle on Friday night, November 5th,  around 10:30 PM.  I met Brian Knight and Tim Moolic (Pragmatic Works COO) and we drove about 1.5 hours to Ashford, WA.  We settled in to our cabin on the Creek for a few hours of sleep before we began our BIG adventure.  About a month before PASS Brian gave me a call and asked if I would like to join he and Tim on a hike up Mt. Rainier.  I hesitated at first, but then quickly decided to do it.  So here I was, about to start a hike up the mountain in what we were told was some very unfavorable weather conditions.

IMG_1064 As you can see from the background, the weather was not very kind.  It was snowing, raining, and sleeting all at once.  If that is possible, but we were brave and had already rented all the gear so we did not really have a choice.  If you take a close look at my face in the picture you realize that I was the only one not smiling.  If you don't know I currently live in Louisiana and I was born in Houston, Tx.  Snow is not a common occurrence in either of these places.  To be honest I almost backed out, but my EGO wouldn't let me, besides these two guys would have never let me live it down.  So on to the hike.

I thought we were going to have a slow start to the hike, boy was I wrong.  Tim took off like he was running a 40 yard dash.  By the way, Tim lives in Boston so he is very familiar with snow and how to get around in it.  After about the first 200 feet I was done.  I wanted to turn back and find a nice warm place with a hot cup of coffee.  Again, my EGO took over and forced me to continue.

We hiked up for about 3 hours or 4000 feet, stopping a few times along the way for a little water, snacks and sight seeting.  At one point I found myself nearly waste deep in snow. Since I am not very familiar with snow, I did not realize that I should have been wearing the Snow Shoes that we rented.  Tim quickly brought that to my attention after I trudged through the snow for about 100 or so feet.
 SANY0024
The visibility worsened as we hiked higher and we decided to call it quits after we reached about 8000 feet.  We did not want to take the chance of hiking down in the dark and getting lost.

IMG_1072

This was the first time that I had ever experienced so much snow in my life.  Would I do it again?  Yep, without a doubt.  Since the PASS Summit is in October next year, the weather should be better and we should be able to hike a little higher.  At the end of the day we were exhausted, exhilarated, and ready for a drink.  We ended our night at a the only restaurant in Ashford.  We enjoyed a nice dinner with a few drinks some food and a little fun (Karaoke). 

IMG_1136 IMG_1148

All SMILES!!!!!  This was just day one of my PASS adventures.  Stay tuned for more adventures.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS, Mountain Man

Sunday, November 14, 2010

Join SQL Lunch on Tuesday

What a long week at PASS (stay tuned for more details about my trip).  Now that it's over back to work.  Join me and Cade Roux for a SQL Lunch on Tuesday.  Cade is lives in the rocking city of New Orleans, LA.
#41-Get a Lever and Pick Any Turtle: Lifting with Metadata

Lunch Image

Speaker: Cade Roux

Add To Outlook: Add To Calendar

Date and Time: 11/16/2010 11:30:00 AM CST

Live Meeting URL:  https://www.livemeeting.com/cc/usergroups/join?id=68R4BF&role=attend


BIO: Cade Roux, is the recent founder of Rose Crescent, a software and systems consultancy in New Orleans. He has been a professional programmer since 1992, and a user of SQL Server since 1997, managing IT operations at all levels of organizations. He has broad experience in several lines of business, including Route Accounting, Medical and Banking and technical exposure ranging from C/C++ to T-SQL, from the Windows API to Data Warehousing. He loves building great systems and great teams.


Topic: #41-Get a Lever and Pick Any Turtle: Lifting with Metadata

Integrated metadata is a required element of all RDBMSs. In addition to ANSI INFORAMTION_SCHEMA and metadata on implementation-specific features like indexes, SQL Server also offers a very powerful extended properties feature. In this talk, I cover using the basic metadata combined with extended properties and demonstrate practical usage to organize and document a system's design and monitor the health of a system's compliance with design rules.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS, founder SQLLunch.com

Wednesday, November 3, 2010

A Couple of SQL Lunches this Week

I want to apologize for posting this so late, but there is a SQL Lunch today and one tomorrow.  Hope you all can make it.

#37-Zero to Dashboard

Lunch Image

Speaker: Adam Jorgensen

Add To Outlook: Add To Calendar

Date and Time: 11/3/2010 11:30:00 AM CST


BIO: Adam Jorgensen , MBA, MCDBA, MCITP: BI has over a decade of experience leading organizations around the world in developing and implementing enterprise solutions. His passion is finding new and innovative avenues for clients and the community to embrace business intelligence and lower barriers to implementation. Adam is also very involved in the community as a featured author on SQLServerCentral, SQLShare, as well as a regular contributor to the SQLPASS Virtual User Groups for Business Intelligence and other organizations. He regularly speaks at industry group events, major conferences, Code Camps, and SQLSaturday events on strategic and technical topics.


Topic: #37-Zero to Dashboard
Come have some fun seeing how we can build your first dashboard in PerformancePoint Services Together. Join Adam and Go from Zero to Dashboard and see some of the cool reporting techniques you can do with Performance Point without writing any code!

#42-Auditing Database Permissions in SQL Server

Lunch Image

Speaker: K. Brian Kelley

Add To Outlook: Add To Calendar

Date and Time: 11/4/2010 11:30:00 AM CST


BIO: Brian is a SQL Server author, columnist, and Microsoft MVP focusing primarily on SQL Server security. He is a contributing author for How to Cheat at Securing SQL Server 2005 (Syngress) and Professional SQL Server 2008 Administration (Wrox). Brian currently serves as a database administrator / architect for AgFirst Farm Credit Bank where he can concentrate on his passion: SQL Server. He previously was a systems and security architect for AgFirst Farm Credit Bank where he worked on Active Directory, Windows security, VMware, and Citrix. In the technical community, Brian is president of the Midlands PASS Chapter, an official chapter of PASS. Brian is also a junior high youth minister at Spears Creek Baptist Church in Elgin, SC.
Topic: #42-Auditing Database Permissions in SQL Server


Invariably, the dreaded auditors will come knocking at your door wanting to know who can do what in a database. Knee deep in other initiatives, the last thing you want to do is parcel out the time required to answer their requests and the follow-on questions they're likely to have. However, you know that this these are requests you can't refuse and you resign yourself to your fate. In this presentation, Certified Information Systems Auditor (CISA) and Microsoft SQL Server MVP K. Brian Kelley will cover what to audit, how to audit it quickly and efficiently, and the gotchas to look out for when it comes to compiling and reporting database permissions in SQL Server. Coverage of the security catalog views to use in SQL Server 2005/2008 as well as capturing implicit permissions will be focused on.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, founder SQL Lunch.com

Sunday, October 31, 2010

Vote for Our SQL Rally Pre-con

VOTE VOTE VOTE VOTE VOTE VOTE VOTE!!!!!!!!!!

Vote here:  http://www.zoomerang.com/Survey/WEB22BD59JCQBT

Honestly, I want each of reading my blog to vote for our Pre-con(Full Day Business Intelligence Workshop).  However, as with any voting process you have choices.  Well....in most cases you do.  We often feel or believe that our vote does not count.  I really believe that this is going to be a little different.  I am really excited about the SQL Rally and more excited that our Preconference seminar was selected as one of those that are now being voted upon.  So, why should you vote for our Pre-con?

I have been referencing the pre-con as "Ours", that is because four individuals will be delivering the conference.  The team of presenters/authors include Adam Jorgensen, Mike Davis, Devin Knight, and myself.  I am not going to list the credentials for each person, but I will say that each presenter has taught full day courses in building Data Warehouses, SSIS, SSAS, and SSRS.  In addition, we are all regular speakers at various SQL Server events, including SQL Saturdays, Users Groups, and PASS.

Still not convinced?  Each member of this team has designed, created and delivered solutions that encompass each of the tools that will be presented during the Precon.  First, we will spend time teaching you how to transform your Operational database to a data warehouse.  Adam Jorgensen will take a deep dive into Dimensional Modeling and all the techniques required to create you data warehouse database.  In the next three sections, which are all very demo-centric, you will learn from Devin Knight, Mike Davis and myself how to build SSIS Packages to load your data warehouse fully or incrementally, then we will show you how to create and maintain an SSAS cube and finally we will use SSRS to create visually appealing reports for your end-users.

This may seem like a lot to accomplish in one day, but we will be taking a very explicit and focused approach in regards to each technology.  For example, we are not going to discuss every transform in the SSIS control and data flow toolboxes.  However, we will provide detail explanations of the tasks that are vital when building and ETL solution.  At the end of the day you will leave with the knowledge and tools needed to build a complete data warehouse solution.  As an extra touch, we will not be using the traditional Adventure Works database for our demonstrations.  We will be using some real world data that will enhance the discussions and potentially create a more engaging learning experience for all attendees.

So with that, I am not going to restate our abstract, nor am I going to talk about how good all the other sessions are.  What am I going to say is that as a part of the community and a potential attendee of these Precons, go and vote so your can make a difference!  Hey, I kind of sound like a politician, maybe I will run for the PASS board next year ;).  See you all at the PASS Summit in two weeks and hopefully next year at our SQL Rally Preconference Seminar.

Go make it happen! There's a lot of good seminars, go read about them here:

BI Sessions: http://www.sqlpass.org/sqlrally/2011/PreConsforVotingBI.aspx

DBA Sessions: http://www.sqlpass.org/sqlrally/2011/PreConsforVotingDba.aspx

Developer Sessions: http://www.sqlpass.org/sqlrally/2011/PreConsforVotingDev.aspx

Misc Sessions: http://www.sqlpass.org/sqlrally/2011/PreConsforVotingMisc.aspx

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, founder www.SQLLunch.com

Visit www.BIDN.com, Bring Business Intelligence to your company.

Tuesday, October 19, 2010

1st Houston Microsoft Business Intelligence User Group

Tyler Chessman of Microsoft has started a Business Intelligence Users Group in Houston.  The group will meet online  and onsite quarterly.  If you are interested in attending here are the meeting details:

Houston – Microsoft Business Intelligence User Group

We would like to invite you to the very 1st Houston Microsoft Business Intelligence User Group.  This event will take place on Wednesday October 20th, 2010 from 11:15 – 1:00 p.m. at the Microsoft Houston Office  (location and map below).   LiveMeeting will also be available for remote attendees.

Learn the latest and greatest in BI - along with practical advice for getting the most out of your existing technology investments.

No RSVP needed.

Cost

This is a free event; lunch will be provided.

Who should attend

BI Practitioners from both an IT &  business background should attend.   We’ll have two presentations (see Topics below) of interest to both IT and business analysts/power users.

Date
Wednesday, October 20th, 2010.  11:15 a.m. – 1:00 p.m.

Location

One Briar Lake Plaza

2000 W. Sam Houston Pkwy. S. #350

Houston, TX 77042

Phone: (832) 252-4300

See map and/or driving directions

Live Meeting Link for Remote Attendees - Join the meeting

Make sure the Office Live Meeting client is installed before the meeting:

· I am connecting from inside the Microsoft network

· I am connecting from outside the Microsoft network

Topics

· Introducing SQL Server 2008 R2 Master Data Services (MDS):

Master Data Management is a key enabler in improving the timeliness, quality and reliability of BI with the ultimate goal of improving business performance.  This session will be a primer on how to get started with Master Data Management using MDS.

Speaker:  Satheesh Kumar is the principal/lead consultant for Catapult Systems, a Microsoft-focused IT consulting firm. Satheesh has been developing with Microsoft technologies since 1996 and has deep experience in web applications, business intelligence and business analytics. He is currently focused on providing professional solutions using the latest technologies, including the Microsoft BI technology stack.  He has an MBA from RICE University, interested  in data mining research. He can be reached online at http://businessintelligence101.wordpress.com/

· Excel Tips and Tricks - Working with External Data

In this talk, Jim is going to share tips/tricks for working in Excel, specifically how to build flexible data extracts from relational databases, including passing parameters from Excel to SQL Server or Access.

Speaker:  Jim Cline is a Senior Manager of Ad-Hoc Reporting at Service Corporation International, the world’s largest funeral home and cemetery consolidator; he has been with SCI for about 14 years.  Jim’s department creates ad hoc reporting in Excel, Access, SQL Server, and web-based reports and applications.  Jim has a strong business background and mastery of Excel, including:

•         Previously with Arthur Andersen as a tax accountant and real estate appraiser (7 years).

•         Degree from the University of Houston with a BBA in Accounting and Taxation.

•         Founded ClineSys, an Excel and Access training system.  Currently has two Excel courses (2003 and 2007) and two Access/SQL courses (2003 and 2007).  www.ClineSys.com .  ClineSys is approved by the National Association of State Boards of Accountancy (NASBA) and CPAs can earn 40 hours of CPE credit by taking the Excel (2003 or 2007) course.

Come out and support the new group. 

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS, founder SQL Lunch

Visit www.BIDN.com, Bring Business Intelligence to your company.

Monday, October 18, 2010

MDX Puzzles (New Author)

Well I am sure most of you noticed that I haven't posted an MDX puzzle in some time.  After much consideration I have decided to pass the torch to someone that I feel will devote the time needed to help you all continue with your learning.  So with that, I would like to introduce or re-introduce you all to Dustin Ryan the new MDX Puzzle guy.  Dustin is a consultant for Pragmatic Works and a regular blogger on BIDN.com.  He is also very skilled with MDX. 

I am not quite sure when Dustin is going to start posting the puzzles, but I am sure it is going to be soon.  Thanks Dustin for stepping taking in over. 

Talk to you soon,

Patrick LeBlanc (form MDX puzzler), SQL Server MVP, MCTS and founder SQL Lunch

Visit www.BIDN.com, Bring Business Intelligence to your company.

SQL Lunch #40 - Mirroring: The Bear Necessities

I am excited to announce a new speaker to the SQL Lunch, Ryan Adams.  Ryan will be discussing Database Mirroring and how it has become an integral part of high availability and  disaster recovery planning.  See the following meeting details:

Lunch Image

Speaker: Ryan Adams

Meeting URL:  https://www.livemeeting.com/cc/usergroups/join?id=6J9BKQ&role=attend

Add To Outlook: Add To Calendar

Date and Time: 10/19/2010 11:30:00 AM CST
BIO: Ryan is a highly skilled Microsoft oriented administrator and has worked for a Fortune 100 company for 12 years. In his time there he has supported everything from desktop to server. Most recently he has served as a senior Active Directory Architect and Identity Management (MIIS, ILM, FIM) Consultant. He is the sole SQL Server DBA for his group, supporting both vendor databases and custom databases. His primary focus is database design and performance, but also works with SSRS report development, and SSIS ETL. He enjoys being involved in the SQL community and serves on the board of directors for the North Texas SQL Server User Group. He is well versed in many core Microsoft technologies, has implemented and supported them both nationally and internationally for a company of 250k+ users, and holds the following certifications: MCP MCSA MCSE MCDBA - SQL 2000 MCTS - SQL 2005 MCITP - SQL 2005


Topic: #40-Mirroring: The Bear Necessities
Mirroring can be an integral part of your high availability and disaster recovery planning. We’ll cover what mirroring is, how it can fit into an HA/DR plan, the rules surrounding its use, configuration via the GUI and T-SQL, as well as how to monitor mirroring. This presentation is designed to not only give you an overview of mirroring, but to also walk you through a basic implementation. At the end you will have learned what mirroring is, how it can fit into your environment, what business requirements it solves, and how to configure it.

See you at Lunch,

Patrick LeBlanc, founder SQL Lunch, SQL Server MVP, MCTS

Visit www.BIDN.com, Bring Business Intelligence to your company.

Thursday, October 14, 2010

Speaking at SQL Saturday #49 Orlando

After making the trip last weekend to Houston for Houston Techfest with the kids I am off again, but this time alone.  On Friday I will fly into Orlando for the Speaker dinner, which is always a lot of fun.  On Saturday I will be presenting two sessions.  The first is a mini session on Speaking and the second is on using Change Data Capture and SSIS to load a Slowly Changing Dimension.  This is my second time speaking at SQL Saturday in Orlando.  If you are in the area stop by.  Registration is still open.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS, Founder SQL Lunch

Visit www.BIDN.com, Bring Business Intelligence to your company.

Tuesday, October 12, 2010

Why do I contribute to the SQL Server Community?

As an active speaker and volunteer in the SQL Server community I am often asked why do I do it?  Sometimes, I actually ask myself that question, but when I think about how the community as a whole operates (quick to answer questions and join discussions) any doubt is quickly removed.  Think about this, in what community can you post a question on twitter or send an email to someone you met at a community event and before you know it, you have several responses to your question.  I became active in the community almost three years ago and I was embraced (not physically, well maybe by a couple) by several people who I considered to be some the of the top SQL Server professionals in the community.  So why not give back?  If I had to list the TOP (5) reasons as to why I do it, it would hard for me to narrow it down.  Fortunately, I am always up to a challenge so here are my TOP 5 reasons:

1.  Contributing to the community, continually increases my knowledge about SQL Server and all of it's components.

2.  Allows me to meet a bunch of really talented SQL Server professionals.  Networking, Networking, Networking....

3.  Can't forget about job opportunities, because I landed my current job with Pragmatic Works at a SQL Saturday event where I was speaking.

4.  Allows me to travel to places that I have never been (a selfish reason) ;).

5.  Honestly, I enjoy it.

So why do you contribute?  Write your own blog post and share it with the community.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS, Founder SQL Lunch

Visit www.BIDN.com, Bring Business Intelligence to your company.

Speaking at South Florida SQL Server User Group

I will be speaking at the South Florida SQL Server User Group on October 13 via Live Meeting.  My topic is Introduction to Change Data Capture with SSIS.  If you have some time logon and watch the meeting.

Meeting URL:  https://www.livemeeting.com/cc/mvp/join?id=PWWZ93&role=attend&pw=47WFd%7EC%5CJ

In thisLeBlanc presentation I will Introduce Change Data Capture and show how it can be used to incrementally load a Slowly Changing Dimension.  Hope to see some of you online.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS, Founder SQL Lunch

Visit www.BIDN.com, Bring Business Intelligence to your company.

Thursday, October 7, 2010

October SQL Server & .Net User Group Meetings

October .NET & SQL User Group Meetings

This month the Baton Rouge SQL Server and .Net user groups are holding a joint meeting.  We will be meeting at our usual location.  If you are around Baton Rouge on Wednesday October 13th stop by.  The meeting details are as follows:

Location:  Lamar Advertising, 5551 Corporate Blvd, Baton Rouge, LA

Date and Time: 10/13/2010 5:45:00 PM
Sponsored By: Sparkhound
Agenda:
5:45 - 6:15 pm: Networking and Refreshments
6:15 - 6:30 pm: Lightning Round
6:30 - 7:45 pm: (.NET) Visualize Data in a “geo way” with WP 7 and Silverlight
6:30 - 7:45 pm: (SQL) Building Spatial Data Reports with SSRS 2008 R2 and Powershell for the DBA
7:45 - until: Open Forum for questions and Raffle

Lightning Round (Lamar Kitchen)
Topic: Introduction to the Pomodoro Technique
Overview: For many of us time is an enemy. The anxiety triggered by “the ticking clock” and deadlines to be met leads to ineffective work and study habits and procrastination. In this lightning round we’ll look at how the Pomodoro Technique can help transform time into a valuable ally.

Speaker: Stacy Vicknair, VB.NET MVP, MCTS

BIO: Stacy Vicknair is a development consultant working for Sparkhound and a Microsoft MVP for two years running in Visual Basic. Stacy blogs at his website, http://www.wtfnext.com, about .NET and other general development topics. He is active in his local community as a committee member for the Baton Rouge .NET User Group (http://www.brdnug.org) and
a co-founder for the Baton Rouge Architecture Group (http://www.braglunch.com).

SQL Server User Group (3rd Floor Conference Room) Two Topics

Session One

Topic: Building Spatial Data Reports with SQL Server 2008 R2 Reporting Services Overview: Microsoft introduced spatial data types in SQL Server 2008 and since has enhanced the reporting capabilities in the following release of SQL Server 2008 R2. This session will introduce the concept of spatial data types in SQL, provide some tips and tools for getting spatial data into SQL, and show different methods for including spatial data in SQL Reporting Services Reports.


Speaker: Mark Verret

BIO: Mark Verret is the Systems Administrator for the LSU Highway Safety Research Group.  He has over 10 years of experience in the IT field.  He has presented at the past two SQLSaturday events in Baton Rouge.  He has functioned as DBA for the past 3 years working with SQL 2000, 2005, 2008, and 2008 R2. 

Session Two

Summary: Powershell for DBAs- introduction and examples of how Powershell 2.0 can make you a more versatile SQL Server Administrator

Speaker:  William Assaf

Bio: William Assaf, MCITP-DD, is a Senior Development Consultant and Team Lead for Sparkhound, Inc. in Baton Rouge, LA.  He blogs on SQL Server at http://sqltact.blogspot.com, where you can find the slides and code examples of this presentation.

.NET User Group (Lamar Kitchen)

Topic: Visualize Data in a “geo way” with WP 7 and Silverlight Overview: Geospatial data is being used everywhere these days, from social media, to citizen reporting 311 applications, to tracking government spending. This talk will discuss design tips and go over the requirements for creating a better user experience and how to visualize data in a “geo way” for Windows Phone 7 and Silverlight applications.


Speaker: Al Pascual
BIO: Company: ESRI
Al Pascual was born, bred and educated in Barcelona Spain,. He moved to England as a young lad to work as a developer in start-ups in the technology field. After seven years working in many small companies, Al moved to California with dreams of stock options to work for another start-up and enjoyed the world of low-level C and C++. After spending a few years working as a consultant, when .NET came out, Al helped companies be more productive. He became a pure web developer, believing that HTTP will rule the world and ASP.NET had nothing to do with classic ASP. Finally growing up and joining the corporate world
to be part of the matrix, Al now has a wife, 3 daughters, 2 dogs, 2 rats, 1 turtle and a mortgage. He’s happy to work for a big company like Esri as a senior software developer working mainly in Silverlight and ASP.NET.

See at the User Group

Patrick LeBlanc, SQL Server MVP, MCTS, SQL Server Chapter Leader

SQL Lunch #32: SSIS Design Patterns, with Andy Leonard

Don't miss SQL Server MVP Andy Leonard on the SQL Lunch, Monday, October 11th.

#32-SSIS Design Patterns 1c: Variables, Events, and Automated Custom Logging Patterns

Lunch Image

Speaker: Andy Leonard

Add To Outlook: Add To Calendar

Live Meeting URL:  https://www.livemeeting.com/cc/usergroups/join?id=JG6T72&role=attend

Date and Time: 10/11/2010 11:30:00 AM CST
BIO: Andy Leonard is an Architect with Molina Medicaid Solutions, SQL Server database and Integration Services developer, SQL Server MVP, PASS Regional Mentor, and engineer. He is a co-author of Professional SQL Server 2005 Integration Services and SQL Server MVP Deep Dives. Andy blogs for SQLBlog.com. His background includes web application architecture and development, VB, and ASP; SQL Server Integration Services (SSIS); data warehouse development using SQL Server 2000, 2005 and 2008.

See you at Lunch

Patrick LeBlanc, SQL Server MVP, MCTS, Founder SQL Lunch

Wednesday, October 6, 2010

Speaking at Houston Techfest

I am heading down to Houston, TX to speak at the Houston Techfest this weekend.  Being a Houston native makes this trip even more exciting.  This is a free event that offers a diverse set of sessions.  The sessions range from What's new in Java to Introduction to Window Azure.   I attended the event last year and if my memory serves me correctly there were only two SQL Sessions.  Fortunately, I was able to convince the event coordinator, Michael Steinberg, to include a full SQL Track at the event. This year the event will host at least 7 SQL Sessions.  I will be giving two presentations.  The first is a presentation on Backup and Data Compression and in the second session I will be introducing the use of Change Data Capture with SSIS. 

This event attracts approximately 1000 people from all across the state.  If you are near the Houston area this weekend I recommend that you try to attend.  Not only is it a great chance to learn something new, but you may even win a Trip to Las Vegas.  One thing I forgot to mention was that lunch is FREE.  So I hope to see you all there.  Also, if you attend my second session of the day you will have a chance to win Knight's Microsoft Business Intelligence 24-Hour Trainer, which I co-authored.  Hope to see you there!

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS, Founder www.sqllunch.com

Visit www.BIDN.com, Bring Business Intelligence to your company.

Monday, October 4, 2010

SQL Lunch One Year Anniversary

I am very excited to announce the 1 year anniversary of the SQL Lunch. Last year around this time I was getting the site up and trying to find a couple of speakers to ensure that we had a good start. I was able to convince Tim Mitchell to speak and the rest is history. Thanks to everyone that has attended all of the lunch events and thanks to all of the speakers who gave their time to make the site a success.

During the first year I gained a co-host (Adam Jorgensen) and several new friends along the way. I also hired the first SQL Lunch employee, Patrick Jr. (my son). He and I are working hard on improving the site and the notifications. Thanks again to everyone and see you at the next SQL Lunch. As always, we are looking for speakers so email us at webmaster@sqllunch.com if you are interested in speaking.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS

Founder SQL Lunch

Sunday, October 3, 2010

Maintain Change Data Capture Configuration when restoring a database

I have been working with a several clients that are leveraging Change Data Capture (CDC) as a tool for incrementally loading their Data Warehouse.  In most cases the clients are using database restores from various environments to create test environments.  When databases with CDC enabled is restored to the same server with the same database name, CDC remains enabled and all related meta data is persisted.  However, when restoring the database to another server or to the same server, but with a new database name, CDC is disabled and all related metadata is deleted.  To retain the CDC configuration when restoring, simply use the KEEP_CDC option when restoring your database.  The following script shows an example of how to accomplish this:

RESTORE DATABASE TestCDC

FROM DISK = 'C:\MMSQL\BACKUPS\TestCDC.bak'

WITH KEEP_CDC

The key item here is to specify KEEP_CDC as an option of the restore.  As always, if you have any questions concerning this post please comment here or send an email to pleblanc@pragmaticworks.com.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS

Founder SQL Lunch

Visit www.BIDN.com, Bring Business Intelligence to your company.

SQL Saturday #57 (Houston) Call for Speakers and Registration is Open!!

So many people have been waiting for a SQL Saturday in Houston and now it’s finally here. As a native of Houston I was surprised that it wasn’t one of the first SQL Saturday venues. Well the wait is over. Thanks to Nancy Wilson, the local SQL Server User Group Chapter Leader, Jonathan Gardner and Malik Al-Aminthe, the first Houston SQL Saturday (#57) will be held on January 29, 2011. Several great sessions have already been submitted, but they are definitely accepting more. In a city the size of Houston they are expecting an overwhelming number of attendees for this event. If you are a speaker that has never given a presentation at a SQL Saturday this may be a good place to get your start. Go here to sign up. If you are not quite ready to speak, but would like to attend click here to register. See you in Houston.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS

Founder SQL Lunch

Sunday, September 19, 2010

SSIS: Assign a value to Variable using Dataflow Script task

I am not quite sure how many of you have tried to set or change the value of a variable using an SSIS script task, but if you have tried I am sure that you may have ran into a few road blocks.  Recently I tried to do this and I quickly realized that it is not as straightforward as I thought.  To do this configure your package so that you have a source of some type on the data flow design surface.  Drag a script task onto the data flow and connect it to the source.  Typically, you would set the variable you want to read from or write to as a ReadOnly or ReadWrite value on the Custom Properties of the script task.

image

This is only the case on the Control Flow.  In the case of the data flow this is not required.  I don't claim to be a developer, but I do know how to use the Internet to find a solution to a problem.  After searching for about 10 minutes I found three posts that assisted me in solving the problem.  Each post provided a little snippet of code that added to my solution.  Here is the code:

   1:      public override void Input0_ProcessInputRow(Input0Buffer Row)


   2:      {


   3:          


   4:          IDTSVariables100 vars = null;


   5:          VariableDispenser.LockOneForWrite("intMaxSalesDetailsID", ref vars);


   6:          if(!Row.SalesDetailID_IsNull)


   7:              vars[0].Value = Row.SalesDetailID;


   8:          vars.Unlock();


   9:      }




On line 4 declare an interface that is going to allow us to access the variable.  In the next line we lock the variable for writing.  In line six ensure that the value that is being assigned to the variable from the Input Row is not null.  Then on the next line set the value of the variable to the desired column from the buffer.  Lastly, unlock the variable.  That's all to it.  If you have other method, preferably a simpler approach, send me an email at pleblanc@pragmaticworks.com or post it here.



Talk to you soon,



Patrick LeBlanc, SQL Server MVP, MCTS



Founder TSQLScripts.com and SQLLunch.com.

Wednesday, September 15, 2010

Baton Rouge SQL Server User Group Meeting Tonight

Last Night (9/14/2010) I had the opportunity to present to the Wisconsin SQL Server User Group.  My topic was SSIS- Configuration Files, Deployment and a Little Performance Tuning.  The presentation was well received and I hope to have the opportunity to speak to the group again on another occasion. 

Tonight(9/15/2010) I will be speaking in front of my local SQL Server User Group in Baton Rouge.  The topic is Loading a Data Warehouse with SSIS.  In addition, I will doing a short presentation (Lightning Round) to the local .Net User group just before the SQL User group begins.  If you are in and around the Baton Rouge area this even stop by.  The details for both groups are as follows:

There will be great prizes supplied by Enta including:

A Nook (plays all three e-reader types), Madden 2011, Windows 7, and many more...

Date: September 15, 2010

Time: 5:45 pm

Location: Lamar Advertising, 5551 Corporate Blvd, Baton Rouge, LA 70808

Sponsored By: User Group Support Services

Agenda:

5:45 - 6:15 pm: Networking and Refreshments

6:15 - 6:30 pm: Lightning Round

6:30 - 7:45 pm: (.Net) Introduction to RIA Services and (SQL) Loading a DataWarehouse with SSIS

7:45 - until: Open Forum for questions and Raffle

Lightning Round (Lamar Kitchen)

Topic: Introduction Data-tier applications

Overview: SQL Server 2008 R2 introduced a new feature called Data-tier applications (DAC). A data-tier application defines the SQL Server Database Engine schemas and objects that are required to support an application. Join Patrick for a brief introduction to this new feature and learn how to author, build and extract the applications from an existing database using Visual Studio 2010 and SQL Server Management Studio.

Speaker: Patrick LeBlanc, SQL Server MVP, MCTS

.Net User Group (Lamar Kitchen)

Topic: Introduction to RIA Services

 Overview: RIA Services and Silverlight 4.0 are recent releases and are tightly integrated with .NET 4.0 and Visual Studio 2010. RIA services is a very powerful productivity tool/framework and can be a bit overwhelming when trying to learn. This session will cover an overview of RIA services and then dive into the details using the new Silverlight Business Application Template in VS.NET 2010. We will cover some tips to modifying the code that is generated by the template to tailor it for most enterprise environments.

Speaker: Mike Huguet

BIO: Company:

Sparkhound Blog: http://geekswithblogs.com/mikehuguet

Mike Huguet is a Solutions Architect for Sparkhound. He is an active member of the community acting as co-leader of the Baton Rouge .NET User Group and committee member for the BR SQL Saturday event. He is also a member of the Microsoft SharePoint Patterns and Practices Advisory team for the recent release for SharePoint 2010. Mike has a software development background and has been working with .NET since Beta 1 of the 1.0 framework.

SQL Server User Group (3rd Floor Board Room)

Topic: Loading a DataWarehouse with SSIS

Overview: With SSIS Data Warehouse developers have a new method of loading their DW. In this session Patrick LeBlanc will show you how to use SSIS to load your Dimensions and Facts. We will discuss different methods that can be used in various environments. He will show you how to fully reload or incrementally load your Data Warehouse.

Speaker: Patrick LeBlanc, SQL Server MVP, MCTS

BIO: Patrick LeBlanc, SQL Server MVP, is currently a Business Intelligence Architect for Pragmatic Works. He has worked as a SQL Server DBA for the past 9 years. His experience includes working in the Educational, Advertising, Mortgage, Medical and Financial Industries. He is also the founder of TSQLScripts.com, SQLLunch.com and the President of the Baton Rouge Area SQL Server User Group. Patrick is a regular speaker at various SQL Server community events, including SQL Saturday’s, User Groups and the SQL Lunch. 

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS

Founder www.TSQLScripts.com and www.SQLLunch.com

Monday, September 6, 2010

Where do you get your motivation and drive?

I was asked by someone the other day, where do you get your drive and motivation? For a second, I was stumped. After giving it a little thought I realized that my drive has several sources. The first is my family of course. My wife has this unbridled drive for success that cannot be measured at any level. Whenever anyone in the house says I can’t, I don’t know how to…, You can’t or some variation of those sentences she immediately corrects us. Can’t is not part of our vocabulary. Next it’s my kids, they think I am Superman, Bill Gates, Jay Z, Barack Obama, a barber, a mechanic, a chef, etc.. You get the picture. It's funny, if we are watching TV or we see someone do something, one of my kids will always say, Dad you can do that.  With that long list of expectations a man has to be driven to learn and succeed.

Then there is the SQL Server Community. For me the community is boundless. We learn from each other. I became active in the community about 3 years ago when I started a SQL Server User Group in Baton Rouge. I had just installed SQL Server 2005 and set up a GEO cluster. In the process I learned so many interesting things about the new features of 2005 and I wanted to share them. I talked to the local .Net user group then I spoke with PASS and the user group was born. After the first presentation I became addicted to presenting. I get a rush from sharing what I learn and for some reason not being able to answer a question. This drives me to learn more so I can share more. So I guess my addiction to presenting and the need to share information is a major contributor to my drive.

Another source and probably the biggest factor to my motivation is myself. Everyone morning when I wake up I say, this is going to be a productive day. What does productive mean? I am going to write a new presentation, I am going to get a new speaker for the SQL Lunch, I am going to help someone solve a problem, I am going to learn something new about SQL Server, I am going to read something new today, I am going to help someone start a User Group. I often end the day with a recount of the day. What did I do? Some would call me a GEEK or maybe even a NERD, but these days that equals success. Think back to your youth, and all of the geeks or nerds that you knew. Look them up. What are they doing? I actually talked to a couple of the GEEKS that went to our high recently and they are pretty successful.  I am not saying that all GEEKS are successful, but there seems to be a decent trend in their favor.

Finally, there's GOD and my parents.  We all know that all this that you know as PATRICK would not exist.  So, I definitely have to mention that trio.

So, what drives you? What is your motivation? Share it with us.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS

Founder www.TSQLScripts.com and www.SQLLunch.com

Friday, September 3, 2010

MDX Puzzle #7 - Solution

Puzzle #7 had an interesting twist.  You were required to add a column to the result set that dynamically displayed a currency type based on the existing currency code.  As always, there are a couple of ways to solve this puzzle.  So here is what I started with:

image

This query satisfies most of the requirements, but one thing you should notice here is the tuple.  I started out here with only the Country and State-Province, which I thought would work.  Then I added the following calculated member:

image

In the calculation I used the IIf function to dynamically determine whether or not the currency code was US or International.  The function is used in the same way as you would use it in Excel or Reporting Services.  It accepts three arguments.  The second and third arguments are returned based on the evaluation of the first argument, which is the logical expression.  This expression should evaluate to true or false.  If it evaluates to true the second argument is returned and if false the third argument is returned.  In addition, I used the CurrentMember function.  This function obtains a reference to the member identified for a particular hierarchy in the current context. When I coupled the function with my initial query, I thought I was done.  Unfortunately, the calculation evaluated every code to International even when it was USD. 

To solve the problem I had to modify the tuple from the first query to include the Source Currency Code.  After the change was made the results satisfied all of the puzzle requirements.  Here is the solution:

WITH MEMBER [Measures].[Currency Type]


AS


IIF


(


    [Source Currency].[Source Currency Code].CurrentMember=[Source Currency].[Source Currency Code].[USD],


    "US",


    "International"


 


)


SELECT 


    {[Measures].[Reseller Sales Amount],[Measures].[Currency Type]} ON COLUMNS,


    NONEMPTY(


    


    {


        (


            [Sales Territory].[Sales Territory Country].[Sales Territory Country],


            [Geography].[Geography].[State-Province],


            [Source Currency].[Source Currency Code].[Source Currency Code]


        )


    }


    )ON ROWS


FROM [Adventure Works]










Tell me what you think and post your solutions.  Let's see how much our solutions differed.  Stay tuned for Puzzle #8.



Talk to you soon,



Patrick LeBlanc, SQL Server MVP, MCTS



Founder www.TSQLScripts.com and www.SQLLunch.com.

Monday, August 30, 2010

Join me for Lunch - SQL Lunch #33 (Indicators, Sparklines and Databars)

#33-SSRS 2008 R2 - Indicators, Sparklines and Databars

Lunch Image

Speaker: Patrick LeBlanc

Add To Outlook: Add To Calendar

Live Meeting URL:  https://www.livemeeting.com/cc/usergroups/join?id=RZW5HJ&role=attend

Date and Time: 9/1/2010 11:30:00 AM CST
BIO: Patrick LeBlanc, SQL Server MVP, is currently a Business Intelligence Architect for Pragmatic Works. He has worked as a SQL Server DBA for the past 9 years. His experience includes working in the Educational, Advertising, Mortgage, Medical and Financial Industries. He is also the founder of TSQLScripts.com, SQLLunch.com and the President of the Baton Rouge Area SQL Server User Group. Patrick is a regular speaker at various SQL Server community events, including SQL Saturday’s, User Groups and the SQL Lunch.
Topic: #33-SSRS 2008 R2 - Indicators, Sparklines and Databars
SQL Server Reporting Services R2 introduced several new features. In this lunch Patrick LeBlanc will provide three demonstrations that will show you how to create Indicators, Databars and Sparklines on your reports.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS

Founder www.TSQLScripts.com and www.SQLLunch.com.

Sunday, August 29, 2010

MDX Puzzle #7

I have presented you with a couple of easy puzzles in the last few posts.  So, let's step it up a little with one that is a little more challenging.  I have to be honest, this puzzle was sent to me by one of my co-workers at Pragmatic Works.  Here are the requirements:

Columns:  Reseller Sales Amount and using the Source Currency Code add a column to the result that displays US if the currency code is USD and International for all other currency codes.

Rows:  Country and State-Province

Filters:  None

Hint:  You may need to use a CASE statement or the IIF function.

Your results should show Reseller Sales Amount by Country and State-Province.  An additional column will also be included that displays the currency type.  Be careful when designing your tuple for the rows.  You may notice that I have intentionally omitted one small nugget of information in the requirements.  Your results should resemble the following:

image

Notice the additional column that corresponds to the currency code.  Remember, don't post your solution here.  Save them for my solution post.  I will post it along with the steps that was taken to solve this puzzle in a couple of days. 

Don’t forget to check back in a couple days for the solution.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS

Founder www.TSQLScripts.com and www.SQLLunch.com.

Friday, August 27, 2010

MDX Puzzle #6 - Solution

Puzzle #6 should not have presented too much of a challenge, it's intentions were to introduction you to the ORDER function that is available in MDX.  Ok, so this is what I started with:

image

This is a very simple statement that satisfies most of the puzzle requirements.  The only one that is does not satisfy is the ordering of the results.  To do this I used the ORDER function.  The function accepts two arguments.  The first is a valid expression that returns a set.  In this example it is the set of Product Subcategories.  The next argument is the numeric or string expression, which will be used to determine the order.  Finally, you must include the direction that your want to order by, DESC or ASC.  There are a couple of more, but I am saving them for a later puzzle. 

Modifying the above query to include the ORDER function yields the result to this puzzle.  See the following:

image

Stay tuned for Puzzle #7, I promise it will be a little more challenging.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS

Founder www.TSQLScripts.com and www.SQLLunch.com.

Visit www.BIDN.com, Bring Business Intelligence to your company.

Tuesday, August 24, 2010

MDX Puzzle #6

As we continue with the puzzles, I will continue to introduce new MDX functions.  In this puzzle the requirements are as follows:

Columns:  Reseller Sales Amount

Rows:  Product Subcategories

Filters:  None

Hints:  This puzzle is too easy for a hint. ;)

Ahhhh, but there is one additional requirement, the resulting rows should be returned in DESC order by Reseller Sales Amount.  Remember, don't post your solution here.  Save them for my solution post.  I will post it along with the steps that was taken to solve this puzzle in a couple of days.  Here is a screen shot of what the results should look like:

image

Don’t forget to check back in a couple days for the solution.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS

Founder www.TSQLScripts.com and www.SQLLunch.com.

Visit www.BIDN.com, Bring Business Intelligence to your company.

Sunday, August 22, 2010

SQL Saturday #28 - Lessons Learned

After spending a week in Tampa, FL at a client site I've had some time to unwind and reflect back on SQL Saturday #28.  I have received some really positive feedback from all individuals involved.  While I can't say that every aspect of the event was excellent, I can say that compared to last years event this one far exceeded any of my expectations. I have read several blog posting about the event and I have to issue one correction, most of you are reporting our attendance as 350 attendees.  That is a little off.  After reviewing our attendance roster our final tally was 397 signed in attendees.  I know this is not a numbers game, but for little Baton Rouge, LA this is a big number.  Ok, now that I have that out of the way let's talk about a few lessons we learned from the event.

1. More Signs on Campus: Our event was held on the beautiful campus LSU.  If you are familiar with the campus finding the location is a easy.  On the other hand, if you are not then you can get lost easily.  We only had signs on the main streets into and off of campus.  At the next event we need to add signs from the event hotel directly to the event.  Even though the event and the hotel are located on the campus, the hotel is a bit of a hike from the event.  You can easily get lost.  I am sure a couple of our speakers can attest to that. In addition, we will include more signs on the the main streets and at various locations leading up to campus.  This is one aspect that tends to be overlooked, but after this event I realized that this is a vital component to a successful event.

2.  Physical Address:  Having the event on a very large college campus can present a challenge when attempting to map out a physical address.  This can be attributed to the fact that building on campuses change names, which can cause a problem as we found out.  I thought that we had the correct address, but most GPS devices could not locate the address.  As a result, we have decided to include Longitude and Latitude coordinates in our correspondence next year.

3.  Air Conditioning:  Everyone knows that it is HOT in Louisiana, so to prevent any complaints about the heat we coordinated with the facility to ensure that the AC was on all night the day before the event and all day the day of the event.  Even with that, it was still warm in some of the rooms.  We are currently looking for ways to solve this problem.  Nothing yet, but we have about 359 days until our next event.  I am sure we will come up with something.

4.  Food:  Now, this is a touchy topic for me, since we did not charge for Lunch.  I read a blog post about SQL Saturday #28 that started out very positive, but ended really bad.  The bad part of the blog was in regards to the food that we served.  How could food be bad if it is FREE?  For breakfast we served, donuts, muffins, coffee, water and soda.  This is typical for most of the SQL Saturday's that I have attended.  In addition to those items I have seen fruit, but with our humid and hot environment we voted against the fruit.  This was the last thing that I thought anyone would complain about, but our breakfast was described as horrendous.  Wow, such a harsh word.  I will say this, if you plan on attending next year, the only thing that we will change about breakfast is to buy more of the same because there wasn't a donut or muffin left.  For lunch we had a boxed Subway lunch, which is another typical item served during SQL Saturday's.  Maybe not Subway, but the boxed lunch with a sandwich, chips and cookie.  Everyone who was there when lunch was served received a FREE lunch.  We do plan on upgrading lunch next year, but we are only upgrading the lunch provider not the type of lunch.  A box lunch is convenient for our lunch team.  You can easily distribute them and the garbage collection is quick.  I don't recall what the post stated directly about the lunch, but I do remember a comment about the lackluster thought that was put into it.  In the afternoon, we supplied a snack of cookies and crackers, which is not a typical SQL Saturday practice.  Since the lunch is small, we decided to provide a little extra snack to all those that decided to stick around all day.  Not sure where to complain about any of the items, but since there was a complaint it has to be labeled as a bad.  We are going to discuss our food choices and there maybe some slight changes, but nothing too drastic.  We are on a budget, and I believe that charging for lunch is a deterrent to potential attendees.  As a result, we provide a low-cost, but quality lunch to our attendees.  Two years in a row and only 1 complaint about lunch that I know of, I would say those are good numbers.

5.  Too much .Net:  A lot of the SQL folk stressed their concern about the 4 .Net tracks at our SQL Saturday.  I have to be honest, initially I was concerned about this myself, but after the day started and I walked around and visited each room as the classes were in session I realized that there were plenty attendees to go around.  I was concerned that some of the SQL sessions would have fewer attendees.  I was wrong.  The attendance across all sessions appeared to be evenly distributed.  I also enjoyed the banter between the Devs and DBAs.  Our attendance roster was almost evenly distributed between the two.  I even noticed some of the developers in the SQL sessions and some the DBAs in the developers session.  Maybe we can learn something from each other.

6.  Schedule:  I have to be honest we could have done a much better job on our Event Schedule handouts.  This was probably the most commented about thing at the event, in regards to "Needs Improvement".  We printed a one sheet schedule with the event diagram on one side and he schedule on the other.  Since we had nine tracks it was difficult to fit them all on a regular sheet.  Therefore, we decided to print the schedule on a legal sheet of paper.  On top of that, we decided to fold the sheet and put it in the event bag.  Big MISTAKE!.  The folded sheet was lost in our event bag.  Two things we are going to change.  First, instead of placing the schedule in the bag, it's going to be handed to each person.  Second, we are going to mimic what the guys in Dallas did.  We are going to create an Event Guide that will contain a very detailed schedule of the days events. 

Wow.  I did not intend on writing that much about lunch, but I just couldn't stop.  Please note that I enjoy constructive criticism about anything I do because it only makes me do it better the next time.  Thanks to everyone that has provided really good points, we have some really good documentation and I promise that they all will be addressed.  As with any event there is going to be some good and some bad.  Overall, I have to say that we did pretty good.  Stay tuned, I will be sharing more information about the event.

Talk to you soon,

Patrick LeBlanc, SQL Server MVP, MCTS

Founder www.TSQLScripts.com and www.SQLLunch.com.

Visit www.BIDN.com, Bring Business Intelligence to your company.

Tuesday, August 10, 2010

SQL Reporting Services - Line Graph with a Vertical Bar

So, I was recently asked if you could display a vertical bar on a line graph to denote the last day of the month.  Initially, I had no clue how to solve this problem.  I talked to a couple of people and searched the web, but came up empty.  I decided to just dive into a report and solve the problem on my own.  So I started with the following query that can be run in the AdventureWorks2008 database:

SELECT 


    st.CountryRegionCode,


    CAST(sod.OrderDate AS DATE),


    SUM(sod.TotalDue) TotalDue,


    NULL Marker


FROM Sales.SalesOrderHeader sod


INNER JOIN Sales.SalesTerritory st


    ON sod.TerritoryID = st.TerritoryID


WHERE


    sod.OrderDate BETWEEN '4/28/2003' AND '5/03/2003' AND


    st.CountryRegionCode NOT IN ('US', 'CA')




Note that there is a column labeled Marker that currently has a value of NULL.  It will be explained later in this post.  This query was the basis for this Line Graph:



image



The RED vertical line you see in the graph is just an edit of the image, but this is the expected result.  I have to admit my solution to this problem is somewhat of a hack, but I think it will work.  The first thing i did was append a UNION to the query that would add an additional row which would be used to help create the vertical bar on the line graph. Since the initial query included four columns the UNION had to include four columns.  The only two columns that required values are the OrderDate and the Marker.  In this example, I hard-coded the OrderDate to the last day in April.  You can modify it so that it is a parameter that is selected by the end-user.  The second is a value or marker that will be used to determine the height of the vertical line.  Slight modifications can be made to query to ensure that the value is consistent with the results of the query.  For example, you could select the max from the result and increase it a little to further enhance the visualization.  In this case, since I know the maximum is 300,000, I set it to 350,000.



image



What does the Union accomplish?  This is done to ensure that the Marker value is visible or placed only on the last day of the month.  I know what you are thinking, this is not going to work.  That is what I thought.  To create the vertical line I completed the following steps:



1.  Added the Marker to the Values section of the Report



image



2.  Next right-click the Marker value and selected Change Chart Type. Choose the first column Graph from the column section.



image

















3.  Now right-click on the bars on the graph and selected Series Properties.  Choose Fill from the navigation pane and choose Red from the Pick color section.



image



4.  With the bars selected on the graph open the properties windows.  Then expand the Custom Attributes property. Finally change the PointWidth value to .2.  This changes the sizes of the bar.



Now run the report.  Your report should resemble the following:



image



You will see a single vertical bar whose point on the x axis is the last date of April and whose value is 350,000.  This line is a bar graph that has been customized to resemble a vertical line.  I am not saying that this is a perfect solution, but it appears to work.  If you have any other ideas or methods that may solve this problem please post your comments here.  Also, feel free to email me at pleblanc@pragmaticworks.com.



There are several ways to accomplish this, but this solutions does work.  Stay tuned for Puzzle #6.



Talk to you soon,



Patrick LeBlanc, SQL Server MVP, MCTS



Founder www.TSQLScripts.com and www.SQLLunch.com.



Visit www.BIDN.com, Bring Business Intelligence to your company.