Business Intelligence Blogs

View blogs by industry experts on topics such as SSAS, SSIS, SSRS, Power BI, Performance Tuning, Azure, Big Data and much more! You can also sign up to post your own business intelligence blog.

«September 2015»
MonTueWedThuFriSatSun
31123

Executing DBCC for SQL Server Analysis Services 2016

In the upcoming release of SQL Server Analysis Services 2016, one of the new features you’ll see is the ability to perform a database consistency check against your SSAS cubes and Tabular models. Just like in the database engine side of things, DBCC for SSAS checks for corruption across the entire database or individual objects within the database.

The DBCC command is shaped likes the XMLA Process command so there’s not a lot of complexity to it. Below here, you can see the basic syntax for the SSAS DBCC command. Its worthing noting that the syntax of the command will look the same whether you’re running it against an SSAS multidimensional database or Tabular model.

"http://schemas.microsoft.com/analysisservices/2003/engine">
    <Object>
        
        
        
        
    Object>

To run the DBCC command, just open a new MDX query window and use the code seen above. Enter in the IDs of your Database, cube, measure and/or partition.

When you’re running the DBCC command against a Tabular model, there are a couple things I’d like to point out.

In the element for the CubeID, you’ll need to specify the ID of the Model. And in the element for the MeasureGroupID, specify the ID for the table you want to check.

DBCC XMLA command for SSAS

If you want to check the whole database or model for consistency, simply remove the elements the lower elements. For example, if I wanted to check the whole model, I just would leave out the elements for MeasureGroupID and PartitionID.

To find the MeasureGroupID (Table ID) or PartitionID in a Tabular model, just navigate to the Properties for that object.

Find the SSAS Tabular MeasureGroup ID or Table ID

To find the Partition ID in a Tabular model, right click the table and select Partitions. Then highlight the partition you want to check and click the Settings icon.

Find the SSAS Tabular partition ID

If you run SQL Server Profiler against SSAS while executing the DBCC command, you can see the individual checking of the columns, tables, database and more.

SSAS Tabular Profiler trace DBCC

I also ran a trace against my SSAS 2016 OLAP instance to watch each segment of

Read more
456
78910111213
14151617181920
21222324252627
2829301234
567891011

SSIS For Each Column in a Data Flow

  • 29 May 2011
  • Author: MikeDavis
  • Number of views: 13114
  • 0 Comments

When you want to transform data in a data flow task in SSIS, the derived column transform performs this very fast due to the batch method. But if you have hundreds of columns that need the same transform performed on them, it can be very time consuming to create each of these derived column expressions. You can use a script task to loop through the columns in a data flow and perform the same task on every input column you select in the script task. Keep in mind, this will degrade performance, but it will make the development faster.


Here are the first few rows of the million row table I am going to use to demonstrate the functions. Let’s say we need get just the first 3 characters on each of these fields.

SSIS For Each Column in a Data Flow


 
First I will show how to complete this with a derived column. It is just a simple substring command on each column. This is a small example. Imagine if you had hundreds of columns that need this transform. This would be a very time consuming process. This derived column will work and perform very fast.

SSIS For Each Column in a Data Flow
 

With a script task you will need to import the System.Reflection namespace. This will allow you to refer the columns in the data flow. Then we will create a For Each Loop to loop through each column.  The first thing we need to do is place a check next to each column we want the script task to substring and set them to read write so we can update them.

SSIS For Each Column in a Data Flow

Here is the code in the script task that will perform the substring function needed.

        Dim column As IDTSInputColumn100
        Dim rowType As Type = Row.GetType()
        Dim columnValue As PropertyInfo

        For Each column In Me.ComponentMetaData.InputCollection(0).InputColumnCollection
            columnValue = rowType.GetProperty(column.Name)
            Dim strCol As String = columnValue.GetValue(Row, Nothing).ToString()
            strCol = strCol.Substring(0, 3)
            columnValue.SetValue(Row, strCol, Nothing)
        Next


Both of the above transforms will give you the below output.

SSIS For Each Column in a Data Flow

The derived column performed this operation on one million rows in 6 seconds. The Script task took 406 seconds, over 6 minutes, on the same one million rows. This is a massive performance loss. I would not suggest using the script task method due to the performance loss. Although if you know the number of rows will always be low and the table is very wide and has a lot of columns that you need to perform the same function, then it can be used with no scalability.

Print
Tags:
Rate this article:
No rating
MikeDavis

MikeDavisMikeDavis

Other posts by MikeDavis

Please login or register to post comments.