Converting a varchar to a date in Oracle

DISCLAIMER: This method should only be used when you absolutely have to use it. The performance on this little trick sucks and if at all possible you should keep your date data in date fields. While working with an Oracle table I ran into a situation where I had to select some date data that was stored in a varchar … Read More

Mike GriffithConverting a varchar to a date in Oracle

Ordering with row limiting in Oracle.

I encountered this issue after I started working with Oracle after working with SQL server for about 15 years. After all that time I’d forgotten a few things about how Oracle behaves. One of the things that I had forgotten was that Oracle applies the limiting before ordering the data from the select, so if you are expecting to have … Read More

Mike GriffithOrdering with row limiting in Oracle.

SSIS error : ‘Unable to retrieve column information from the data source. Make sure your target table in the database is available.’

I encountered this error while calling a stored procedure in SSIS one day. The stored procedure was calling Oracle via a linked server. Evidently when SSIS calls a stored procedure it gets a set of fields, but since the linked server call couldn’t give it a compiled list of fields it was causing an error. To fix the problem all … Read More

Mike GriffithSSIS error : ‘Unable to retrieve column information from the data source. Make sure your target table in the database is available.’

Connecting Visual Studio 2013 with Git and Bitbucket

The first step you need to take is to setup Visual Studio to use the Git Provider. To do this you need to go to Tools -> Options and select the Git service provider. Then select the Open from Source Control option then under Local Git Repositories choose the Clone option and fill in your git settings for BitBucket. Now … Read More

Mike GriffithConnecting Visual Studio 2013 with Git and Bitbucket

Performance issue querying Linked Servers in SQL Server

When querying a linked server in SQL server there are basically two different ways to do it. Four Part Naming There is the four part naming method which calls the object directly while tacking on the linked server name to the table you are querying.

And this method is nice and simple, but it works by passing the full … Read More

Mike GriffithPerformance issue querying Linked Servers in SQL Server

Excluding certain fields in a SQL AVG field with a Case statement.

If you need to get an average of a field during a query, but exclude a few groups you can use a case statement inside of an AVG call to eliminate those groups from the average. All that you need to do is return a null for the value in the case statement. For example the following code will get … Read More

Mike GriffithExcluding certain fields in a SQL AVG field with a Case statement.

An elegant way to write XML with Linq

While writing out some XML to a file I found a lot nicer way to write out XML while using Linq and the XStreamingElement. The key is to use the XStreamingElement with data from a Linq datasource like so :

The above code will create the xml below (if the data is formatted correctly).:

As an added bonus … Read More

Mike GriffithAn elegant way to write XML with Linq

The importance of getting involved in your community to teach programming

Current Environment Lately there has been a lot of talk and work being done on teaching people to code. For example code.org and codecombat.com are some awesome examples that I really wish I’d had when I was growing up. But there is one thing that all of these wonderful sites can’t do and that and is to get out in … Read More

Mike GriffithThe importance of getting involved in your community to teach programming

The type initializer for ‘AutoMapper.TypeMapFactory’ threw an exception. Error with Automapper.

Recently while doing some conversions with Automapper I ran into an error while running it. I was getting the “The type initializer for ‘AutoMapper.TypeMapFactory’ threw an exception.” with an inner exception of “This type is not supported on this platform IDictionaryFactory”. After doing some debugging I finally figured out that it was due to the Automapper dll itself not being … Read More

Mike GriffithThe type initializer for ‘AutoMapper.TypeMapFactory’ threw an exception. Error with Automapper.

Replacing strings with the Filehelpers library.

While working at my current job I’ve been doing a lot of file imports and conversions, so to figure out a more efficient way to do the conversions I did some research and found the FileHelpers library. Now the FileHelpers library makes things very easy to do field conversions by creating attributes that you can connect to each record field … Read More

Mike GriffithReplacing strings with the Filehelpers library.