Archive for 2009

SSIS: Archiving files with VB.Net

When creating SSIS packages it’s a common requirement to be able to archive the processed files. Here’s VB.Net code snippet, with a quick walkthrough, that does exactly that. The script uses two variables, inFiles and archiveFiles. The variable inFiles contains the folder we want to move files from, and archiveFiles is the destination. Configure your […]

Trimming Whitespace with Powershell

A few days ago I was working with a client that was providing an export of data from Oracle. The file being produced was choking my SSIS package due to various formatting issues. After working with the client and getting a file that looked good to the naked eye I discovered that a large amount […]

Ordering by Column Value in SQL Server & MySQL

Today I needed to order some data by specific column value and I recalled the really handy FIELD function in MySQL. Here’s a demo of this feature in MySQL ?View Code MYSQL# Test table CREATE TABLE City ( Id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, City VARCHAR(50) );   # Insert some test data INSERT […]

Computed Columns in SQL Server

So exactly what is a computed column? MSDN has this to say A computed column is computed from an expression that can use other columns in the same table. The expression can be a noncomputed column name, constant, function, and any combination of these connected by one or more operators. The expression cannot be a […]

Splitting csv files with Powershell

I’ve blogged before about the usefulness of Powershell for data tasks. A few weeks ago I had a requirement at work for merging csv files and recently I needed to split a single csv file into several files. While this is easy to do using SSIS and a bit of T-SQL it is a little […]