THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Jorg Klein

Microsoft Business Intelligence consultant from the Netherlands

  • SSRS – Static column headers in a Matrix

    How do you create a static column header centered above your dynamic columns? One way to try achieving this is to place a textbox above your dynamic columns. One thing is for sure, the textbox will never be on the perfect centered location and what if the number of dynamic columns grow or shrink?

    Thing you need to do is to create a static column group. You do this by adding a new column group to the matrix and give it a static expression, for example: =”static”
    Now make it the top group by clicking Up for the static column group on the Groups tab of the matrix’s properties. You can also achieve this by just dragging the column group up in the layout view.

    The result, a centered and perfect aligned column header with the text “YTD” above some dynamic columns containing years:

  • SSIS - Convert various String date formats to DateTime with the Script Task

    The script below is really nice if you need to convert String dates that come in different (unexpected) formats.
    Just copy and paste the code in your Script Task (paste the function outside Main()) and it works right away.

    Supported date formats:

    • YYMMDD
    • YY-MM-DD
    • YYYY-MM-DD

    Of course it's possible to add code for more date formats yourself. If you want to, copy and paste your code in a comment. I will then add the code to this blog.


    Public Shared Function GetDateFromString(ByVal stringDate As String) As DateTime

            Dim datetimeResult As DateTime


                Dim centuryToAdd As Integer = 1900

                If (Convert.ToInt32(stringDate.Substring(0, 2)) < 80) Then

                    centuryToAdd = 2000

                End If

                If (stringDate.Length = 6) Then

                    'Format is: YYMMDD

                    datetimeResult = New DateTime((centuryToAdd + Convert.ToInt32(stringDate.Substring(0, 2))), Convert.ToInt32(stringDate.Substring(2, 2)), Convert.ToInt32(stringDate.Substring(4, 2)), 0, 0, 0)

                    Return datetimeResult

                End If

                If (stringDate.Length = 8) Then

                    If (stringDate.IndexOf("-") > 0) Then

                        'Format is: YY-MM-DD

                        datetimeResult = New DateTime((centuryToAdd + Convert.ToInt32(stringDate.Substring(0, 2))), Convert.ToInt32(stringDate.Substring(3, 2)), Convert.ToInt32(stringDate.Substring(6, 2)), 0, 0, 0)

                        Return datetimeResult

                    End If

                    'Format is: YYYYMMDD

                    datetimeResult = New DateTime(Convert.ToInt32(stringDate.Substring(0, 4)), Convert.ToInt32(stringDate.Substring(4, 2)), Convert.ToInt32(stringDate.Substring(6, 2)), 0, 0, 0)

                    Return datetimeResult

                End If

                If (stringDate.Length = 10) Then

                    'Format is: YYYY-MM-DD

                    datetimeResult = New DateTime(Convert.ToInt32(stringDate.Substring(0, 4)), Convert.ToInt32(stringDate.Substring(5, 2)), Convert.ToInt32(stringDate.Substring(8, 2)), 0, 0, 0)

                    Return datetimeResult

               End If

                Return Convert.ToDateTime(stringDate)

            Catch e As Exception

            End Try

            'No date format found: Return unknown(1/1/1900)

            datetimeResult = New DateTime(1900, 1, 1, 0, 0, 0)

            Return datetimeResult

        End Function


    If you want to convert a String SSIS variable and load it into a DateTime SSIS variable, use the following code in your Script Task:

    Dts.Variables("someDateTimeVariable").Value = GetDateFromString(Dts.Variables("someStringVariable").Value.ToString)


  • MCITP - I passed the 70-446 “PRO: Designing a Business Intelligence Infrastructure by Using Microsoft SQL Server 2005” exam!

    Today I passed the Microsoft IT Professional(MCITP) 70-446 “PRO: Designing a Business Intelligence Infrastructure by Using Microsoft SQL Server 2005” exam.
    This makes me one of the 337(January, 2008) Microsoft Certified IT Professionals worldwide! (
    Nr. of MCP's worldwide


    To try the 70-446 exam its required to gain the 70-445 MCTS certification first. I have
    passed the 70-445 exam in November last year.

    The first conclusion I can make is that, strangely, I found the 70-445 exam more difficult than the 70-446 exam. I scored 70% on the 70-445 exam and managed to score 93% on the 70-446 exam. Partially this is because I gained more work experience in the last months and partially it’s because the 70-446 exam contains easier question types.

    The exam topics of exam 70-446 (full list: Microsoft Learning)
    The following list includes the topic areas covered on this exam. The percentage indicates the portion of the exam that addresses a particular skill.


    ·         Planning BI Solutions (15 percent)


    ·         Designing SSIS Solutions (21 percent)


    ·         Designing SSRS Solutions (14 percent)


    ·         Designing SSAS Solutions (22 percent)


    ·         Deploying and Optimizing SSAS Solutions (15 percent)


    ·         Designing Data Mining Solutions (13 percent)

    If we compare this with exam 70-445 we see that data mining is still quite important. Further we see that SSRS gets less attention in exam 70-446.


    70-445 vs 70-446
























    Data mining






    Planning BI Solutions






    Data mining 
    Just like with exam 70-445 data mining is an important topic of the exam! It’s important to know when to use the different algorithms that are shipped with SSAS.

    Training Kit
    Unfortunately there is no training kit available for this exam. You can find the book on some online bookstores but all with the following message: not available. After some research I found out that this book will never come out. I think MS Press will wait until the 70-446 exam for SQL Server 2008 is available.

    Number of questions and completing time
    The exam contains 6 case studies with each 9 or 10 questions. You have 30 minutes for each case, any remaining time from a case won’t go to the next case, so just use your 30 minutes. The 30 minutes were enough for me. I did not study the entire case study in detail before I looked at the questions. I think this is the best thing to do; quickly scan the case study, then look at the questions and then scan the case study for required information regarding the question.
    Just like the 70-445 exam you will require a minimum score of 70% for the exam to pass.


    Question types
    I already mentioned that the 70-446 exam question types were easier than the 70-445 question types. In this exam I only found the question type below, where just one answer can be selected. 70-445 had another 3 question types that were a lot harder then the one below.


    Some useful tips


    ·         Make sure you know exactly how many cube processing types there are and how they work.


    ·         You need to be able to read database schemes.


    ·         The different OLAP types, check this blog of me for more information.


    ·         Data mining is important!

    What should you study
    The lack of a training kit and other study materials designed for this exam makes your studying difficult. What should you study and where should you start?



    Microsoft does have a preparation guide for this exam on the Microsoft learning website. On this page you’ll find the following interesting topics:


    Preparation tools and resources
    This section contains links to classroom courses, Microsoft E-learning resources, Microsoft Press books and practice tests.
    I did all the classroom courses and they helped me prepare for the exam! If you have the possibility to take those courses you definitely should!
    I personally don’t advise you to buy all the Microsoft Press books to study. It’s just too much information and it will cost a lot of study time.
    Practice tests are very useful as preparation, I would advice everybody to purchase a set of preparation questions.

    Skills being measured
    This list contains all the possible exam topics. If you want to prepare yourself efficiently you should just study every item on this list. Search on Google and books online and you will find enough information! I think this way of preparing for the exam is the best way!


    How did I study
    I studied all the topics of the Skills being measured list that you will find in the preparation guide. Next to studying the Skills being measured, I followed all Microsoft Official Courses that are recommended as preparation for this exam:

    Course 2794: Designing a Business Intelligence Solution Architecture for the Enterprise Using Microsoft SQL Server 2005 (two days)

    Course 2795: Designing an ETL Solution Architecture Using Microsoft SQL Server 2005 Integration Services (two days)

    Course 2796: Designing an Analysis Solution Architecture Using Microsoft SQL Server 2005 Analysis Services (three days)


    Course 2797: Designing a Reporting Solution Architecture Using Microsoft SQL Server 2005 Reporting Services (two days)

    Below some links to other useful sites/weblogs about the 70-446 exam:


    If you have any questions, leave them as a comment and I will answer them, if I can. Also, if you have any information regarding the 70-446 MCITP exam, please leave a comment.

    Good Luck!

  • SSAS – MOLAP, ROLAP and HOLAP storage types

    A big advantage of a BI solution is the existence of a cube. Data and aggregations are stored in a optimized format to offer very fast query performance.
    Sometimes, a big disadvantage of storing data and aggregations in a cube is the latency that it implies. SSAS processes data from the underlying relational database into the cube. After this is done the cube is no longer connected to the relational database so changes to this database will not be reflected in the cube. Only when the cube is processed again, the data in the cube will be refreshed.

    SSAS 2005 gives you the possibility to choose different storage types for the following objects:

    • Cubes
    • Partitions
    • Dimensions

    MOLAP (Multi dimensional Online Analytical Processing)
    MOLAP is the most used storage type. Its designed to offer maximum query performance to the users. Data AND aggregations are stored in optimized format in the cube. The data inside the cube will refresh only when the cube is processed, so latency is high.

    ROLAP (Relational Online Analytical Processing)
    ROLAP does not have the high latency disadvantage of MOLAP. With ROLAP, the data and aggregations are stored in relational format. This means that there will be zero latency between the relational source database and the cube.
    Disadvantage of this mode is the performance, this type gives the poorest query performance because no objects benefit from multi dimensional storage.

    HOLAP (Hybrid Online Analytical Processing)
    HOLAP is a storage type between MOLAP and ROLAP. Data will be stored in relational format(ROLAP), so there will also be zero latency with this storage type.
    Aggregations, on the other hand, are stored in multi dimensional format(MOLAP) in the cube to give better query performance. SSAS will listen to notifications from the source relational database, when changes are made, SSAS will get a notification and will process the aggregations again.
    With this mode it’s possible to offer zero latency to the users but with medium query performance compared to MOLAP and ROLAP.

    The different storage types of SSAS:



    Data storage


    Aggregations storage


    Query performance














    Relational database



    Low (none)



    Relational database

    Relational database


    Low (none)



    SSAS offers three storage types that give you all the flexibility you need. You can choose between high performance and high latency on one side(MOLAP) and lower performance but low latency(ROLAP) on the other side. There is also a possibility to choose a way in between(HOLAP).


  • SSIS – Non-blocking, Semi-blocking and Fully-blocking components

    How can you recognize these three component types, what is their inner working and do they acquire new buffers and/or threads?

    Synchronous vs Asynchronous

    The SSIS dataflow contain three types of transformations. They can be non-blocking, semi-blocking or fully-blocking. Before I explain how you can recognize these types and what their properties are its important to know that all the dataflow components can be categorized to be either synchronous or asynchronous.

    ·         Synchronous components
    The output of an synchronous component uses the same buffer as the input. Reusing of the input buffer is possible because the output of an synchronous component always contain exactly the same number of records as the input. Number of records IN == Number of records OUT.

    ·         Asynchronous components
    The output of an asynchronous component uses a new buffer. It’s not possible to reuse the input buffer because an asynchronous component can have more or less output records then input records.

    The only thing you need to remember is that synchronous components reuse buffers and therefore are generally faster than asynchronous components, that need a new buffer.

    All source adapters are asynchronous, they create two buffers; one for the success output and one for the error output. All destination adapters on the other hand, are synchronous.

    Non-blocking, Semi-blocking and Fully-blocking

    In the table below the differences between the three transformation types are summarized. As you can see it’s not that hard to identify the three types.
    On the internet are a lot of large and complicated articles about this subject, but I think it’s enough to look at the core differences between the three types to understand their working and (dis)advantages:





    Synchronous or asynchronous




    Number of rows in == number of rows out


    Usually False

    Usually False

    Must read all input before they can output




    New buffer created?




    New thread created?


    Usually True


    All SSIS transformations categorized:

    Non-Blocking transformations Semi-blocking transformations Blocking transformations
    Audit Data Mining Query Aggregate
    Character Map Merge Fuzzy Grouping
    Conditional Split Merge Join Fuzzy Lookup
    Copy Column Pivot Row Sampling
    Data Conversion Unpivot Sort
    Derived Column Term Lookup Term Extraction
    Lookup Union All  
    Percent Sampling    
    Row Count    
    Script Component    
    Export Column    
    Import Column    
    Slowly Changing Dimension    
    OLE DB Command    

  • SSAS - Visualize Attribute Relationships

    Complicated attribute relationships are difficult to oversee in SSAS 2005. Microsoft solved this problem in SQL Server 2008 with a graphical view of the attribute relationships. Unfortunately, most of us still work with SSAS 2005 and have to wait a couple of months before using the benefits of SSAS 2008.
    Until SQL Server 2008 is fully available it’s good to know there is a way to get some of the new features in SSAS 2005: BIDS Helper.
    It is free to use and offers a lot more than just the visualization of your attribute relationships:
    · Aggregation Manager
    · Calculation Helpers
    · Deploy MDX Script
    · Dimension Health Check
    · Printer Friendly Dimension Usage
    · Show Extra Properties
    · Update Estimated Counts
    · Visualize Attribute Lattice

  • SSRS - Custom expressions for subtotals in a matrix

    If you want custom expressions for your subtotals in a matrix, for example to calculate an average instead of the default sum, you need to use the InScope() and Iif() functions in your data field…

    When you create a matrix with SSRS you get the following default groups:
    A row group named:               matrix1_RowGroup1
    A column group named:          matrix1_ColumnGroup1

    With the normal functionalities you can’t change much on the behavior of your subtotals in your matrix. When you create a subtotal it calculates a subtotal and that’s about it ;-)

    If you use the following expression in the data field of your matrix you can take full control on the behavior of all your subtotals:



                                    "In Cell",

                                    "In Subtotal of RowGroup1"),


                                    "In Subtotal of ColumnGroup1",

                                    "In Subtotal of entire matrix"))


    Replace "In Cell", "In Subtotal of RowGroup1", "In Subtotal of ColumnGroup1" and/or "In Subtotal of entire matrix" with the expressions or fields that you want.

    For example, if you want to calculate an average:

    Replace "In Cell" with Sum(Fields!Amount.Value)

    Replace "In Subtotal of RowGroup1" with Avg(Fields!Amount.Value)

    More information about the InScope() function on MSDN

  • MCTS - I passed the 70-445 exam!

    Last month I passed the MCTS 70-445 BI exam.
    This makes me one of the 338(October, 2007) Microsoft Certified Technology Specialists worldwide! (
    Nr. of MCP's worldwide)

    The 70-445 exam is the first Microsoft exam I tried. After some research on the internet I only found reactions from people that concluded that this exam was a very hard one.
    So why is this exam difficult? I think it’s because of the amount of detail in the questions. You can expect very detailed questions about, for example, properties of SSIS, SSAS and SSRS.

    Let’s look at the exam topics of exam 70-445: (full list:

    Microsoft Learning)
    The following list includes the topic areas covered on this exam. The percentage indicates the portion of the exam that addresses a particular skill.
    • Managing SSAS (12 percent)
    • Developing SSAS Solutions by Using BIDS (18 percent)
    • Implementing data mining by Using BIDs (12 percent)
    • Managing SSRS (13 percent)
    • Developing Reporting Solutions by Using SSRS (19 percent)
    • Developing Business Intelligence Solutions by Using SSIS (16 percent)
    • Administering SSIS Packages (11 percent)

    Notice that data mining is an important topic of this exam. I know that a lot of people score poor on the data mining questions so take your time to master enough knowledge!
    A lot of the questions have focus on deployment and maintenance. This exam is not about, for example, SSIS tasks and transformations but it is about the deployment of SSIS packages and the working and use of transactions.

    Training Kit
    I used the 70-445 Training Kit from Microsoft Press to prepare for the exam:

    This book will help you a lot while preparing for the exam! It is full of effective information and contains a lot of hands-on labs and test questions. A must have, if you ask me!

    Number of questions and completing time
    As last I can tell you that the exam contains 53 questions and you have 150 minutes to complete it. You will have time enough, so don’t worry about it. You need to score 700 points out of 1000 to pass.

    Question types
    The 70-445 exam is multiple choice, there are no questions that you need to answer by typing text.
    There are 3 types of questions:


    This type of question is the easiest one. One answer can be selected only. I think 60% of the questions are of this type.


    This type of question is harder then type 1. More answers can be selected. In this example only 2 answers should be selected, this can vary. I remember questions with 3 answers that should be selected and also questions where you will be asked to pick 1 or more good answers. I think 25% of the questions are of this type.


    Question type 3 is the hardest. You need to slide 1 or more good answers to the right and arrange them in the right order. I think 15% of the questions are of this type.Please not that if you answer 1 of more possible good answers right(with question types 2 and 3) you get 0 points. So no partial correct answers possible!

    Below some links to other useful sites/weblogs about the 70-445 exam:

    If you have any questions, leave them as a comment and I will answer them, if I can. Also, if you have any information regarding the 70-446 MCITP exam, please leave a comment.
    Good Luck!

    Update: I recently passed the 70-446 Microsoft IT Professional(MCITP) 70-446 “PRO: Designing a Business Intelligence Infrastructure by Using Microsoft SQL Server 2005” exam and wrote a blog about it. Read it here.

  • SSRS – Invalid row heights, BUG?

    Because I got a few reactions regarding the screenshots below (people thought something was wrong with the screenshots) please note that :

    Some of the screenshots below look awful because I selected all the text in the matrices with CTRL-A. I did this to make the differences in row heights clear to see. I also made the numbers in the matrix unreadable.

    As you can see in the screenshot below the row height of rows that contain empty cells differ from the rows where all cells contain data. Screenshot below is taken from IE(with all rows selected), when I run the report in BIDS preview it renders fine!

    I think this is strange if you look at the properties of the rows during the problems:

    Can Grow and CanShrink are set to False so you won’t expect cells heights to grow or shrink. It seems the problem is that SSRS gives empty cells a row height of 0,25(the default) and I use a row height of 0,20. Result is that everything goes fine until there are rows with empty cells. What’s also very strange is that when I made a print of the report, the row heights were all fine!!

    When I faced this problem I just tried a couple of things and it seemed the padding property gave an outcome. When I run the report with the following properties for the rows it renders fine and there are no problems:

    As you can see in the screenshot from IE below, the row heights are fine now!

    It seems that when you
    a) have a matrix with cells that can be empty
    b) you use a row height that’s smaller then the default of 0,25
    you need to use the following properties for your rows in the matrix to prevent problems:

    · Padding: 2,2,0,0
    · VerticalAlign: Middle
    · CanGrow: False
    · CanShrink: False

    What makes this strange to me is that a print of the report and preview of the report in BIDS did not show differences in row heights but Internet Explorer did. This problem occurred with IE 7 and a SQL Server 2005 installation with SP and updates installed.

More Posts « Previous page
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement