C#: Could not load file or assembly

As you may know, I’ve recently tweaked someone’s C# code to make it work the way I want.  That post can be found here.  I am pleased to say that it work perfectly on my laptop but when I loaded it on the server to be executed, I got the error:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.Office.Interop.Excel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or one of its dependencies. The system cannot find the file specified.

Continue reading

SSIS: Data import lesson learnt

Yesterday, I was trying to import a flat file into a sql table.  The table has varchars and ints.  I had to use a data conversion tool to convert to string and 4byte unassigned so it the data type would convert correctly.  Except, SSIS was being a big douche and didn’t want to be nice.  I kept getting errors about the data type coversion for client_id is invalid and blah blah blah.

Continue reading

SSIS: Export more than 255 columns from SQL table to Excel

A few weeks ago, I was looking to export more than 255 columns from a table in SQL to Excel using SSIS.  I thought this task was going to a piece of cake because in SSIS, within the dataflow task, you get an Excel Destination task and this will take care of all my woes!  But alas, it didn’t and I have spent the past 2.5 weeks, not all 8hrs a day, looking for a solution.

Continue reading

SQL: Working with daylight savings

There are a lot of scripts out there that deals with daylight savings. I never really had to deal with it because I’ve always just use UTC/GMT and now that I’m in Arizona, daylight savings … ha … what’s that all about?! Unforunately, I have to deal with it recently in a project I’m working on.  The hours we get from the source is in PST and the client, they want it converted to eastern time.  As I said, there are many scripts out there that does the trick and some requires lookup table, converting from UTC to localtime, to offset, to ms.

They are a bit confusing to me so I dug and dug and found the following solution:

Continue reading

adding timestamp to a filename base on some criteria

This morning, I focused on coming up with something for a client. For the files that we generate, they wanted the timestamp to be either rounded up or down.  If it is less than 15 minutes, round down to the nearest hour; else round up to the nearest hour.

So the logic I can up with is as followed:

Continue reading