Populating Date Dimension with Fiscal Calendar Information

Everyone needs a good script for a date dimension, and with Fiscal Calendar information included this one looks pretty good to me!

http://stephanefrechette.com/date-dimension/

Checking Type mismatch in Recursive CTE – Collation at fault

Took me a while to figure out why there was a type mismatch in a CTE I was writing for in a query the other day, always think about collation, because although it’s in the background for most of the time it can always crop up when you least expect it!

http://consultingblogs.emc.com/paulmcmillan/archive/2011/01/07/sql-collation-gotcha-1-recursive-cte.aspx

WCF or ASP.NET Web API – Which to use?!

Found this interesting article when deciding whether to go with WCF or the newer ASP.NET Web API framework when creating new web services. the Web API looks good as the way to go when creating RESTful services, without all the complex and verbose configuration that comes with WCF.

However, along with that you lose the extra configuration WCF provides you with, such as multiple transport types, duplex communication, message queues etc. So it’s definitely worth considering what the service will be used for before committing to one of them.

http://blogs.microsoft.co.il/blogs/idof/archive/2012/03/05/wcf-or-asp-net-web-apis-my-two-cents-on-the-subject.aspx

Repeating Matrix Column Headers in Reporting Services

Today my afternoon was spent going through a set of standard reports used by some of the customers that I work with, checking layout, formatting etc.

I’d noticed that when a matrix spans over multiple pages, the column headers are not repeated. Foolishly I thought this will be a simple fix, surely just right clicking the group on the group selection at the bottom of report builder, then selecting repeat header…

However, sometimes this isn’t the case, turns out you need to dig a little deeper than that!

Try this…

Select the matrix in question, click the down arrow near row groups and column groups at the bottom, and select ‘Advanced Mode’.

Then select the static row groups that correspond to your column headers, go to it’s properties, and set the ‘RepeatOnNewPage’ property to true.

Works for me, hope it does for you!

This link explains how to do it:

http://forums.asp.net/t/1656471.aspx/1

COM woes – Retrieving COM class factory failed due to the following error: 80040154

I spent ages trying to figure out this problem, when trying to reference Microsoft Office Interop libraries in my project (For manipulating an Excel file programmatically).

Turns out, the dlls I was trying to reference were 32-bit, and the platform my project was set to run on was 64-bit. As I was building this project on a 64-bit machine, Visual Studio set the default platform to be 64-bit.

This is a simple fix: Go to the “Project” menu, select “Properties”, then click the “Build” tab on the side. From here you just need to select x86 from the Platform combo box and rebuild your project. Sorted!

http://forums.asp.net/t/1119052.aspx

Create SQL Table from .NET Datatable in C#

In one of my recent projects I needed to generate a datatable in C# whose fields could vary depending on which properties of a variable needed to be exported from the system. It needed to be able to generate the SQL CREATE TABLE script on the fly and create the table in the database, and then populate the table with the data to export, either using a SqlBulkCopy object or on a row-by-row basis.

The tutorial below provides a good code base to developing this kind of functionality, as well as providing a link to a similar project on MSDN.

http://darrylagostinelli.com/2011/06/27/create-a-sql-table-from-a-datatable-in-c-net/

Dynamically Build SQL MERGE statement in SSIS

http://www.sqlservercentral.com/articles/EDW/77100/

I came across this the other day, when I was looking at using the SQL MERGE statement to replicate the functionality of the Slowly Changing Dimension task in SSIS. There are many benefits to using MERGE instead of the SSIS task, one of my favourites being only having to run 1 SQL statement for the whole task, instead of one for each Lookup, and then subsequent UPDATE or INSERT statement.

This link however, takes it one step further by dynamically building the MERGE statements to use in your ETL. This removes the need to manually update scripts when the table schema changes, such as adding new fields, and makes it a great candidate for quick deployment of Slowly Changing Dimension tasks.

Debugging MDX Queries from SSRS using Profiler and SQL Management Studio

At work recently I came across the need to assess the MDX queries used by some of the reports on our reporting server, along with the parameters that were passed into it (as most of the queries are powered by parameters that are passed into the MDX by parent reports)

Unfortunately, you can’t use SSMS to run parameterised MDX queries like you can in SSRS, but the tutorial below gives a good example using SQL Server Profiler, capturing traces of executed queries by SSRS along with the parameter values used. From here you can just paste the MDX into SSMS, replace the parameter names with the values used and presto!

http://prologika.com/CS/blogs/blog/archive/2009/07/06/how-to-test-ssrs-mdx-queries-in-sql-server-management-studio.aspx

Identifying cause of duplicate attribute keys in SSAS

http://ms-olap.blogspot.com/2009/11/duplicate-attribute-key-has-been-found.html

At work today, I was a bit stumped when SSAS reported the cube wouldn’t build, due to a duplicate key found in the source database, although having checked this there was none to be found.

However after consulting with a colleague, and finding this article on the internet, it turns out that there was a white space after the value of an attribute in the source DB. After SSAS runs the DISTINCT query on the source DB, it trims the white space, and because of that it created a duplicate key.

The post-processing of attributes can be customised in the dimension designer in SSAS. For me it was an issue with the source data, but possibly for you, it might be required to tweak the trimming and null replacement functions.

 

Joseph Arthur

Honey and the Moon – Joseph Arthur

I learnt this song off the back of meeting up with some uni mates for a weekend about a month ago. Recovering from a big night out, this song came up on a programme we watched quite religiously at uni. Yes I might be sad for watching it, but if you know what it is then so are you!

Anyway, thought this song was amazing and had to learn it, although I can’t sing quite as good as Joseph Arthur!

Guitar Tab: http://tabs.ultimate-guitar.com/j/joseph_arthur/honey_and_the_moon_ver4_tab.htm

Go to Top