Dynamic ORDER BY Statement

What really, really kills me is when I was in the situation of needing to order SQL results differently based on a parameter given. Previously I thought I had two options in this scenario: 1. Write some dynamic SQL string...

Read More

VIDEO: Basics of Data Driven Unit Testing

Discusses the absolute base knowledge of creating Unit Tests in Microsoft Visual Studio 2008, using the built in test framework. Specifically towards the end, examples include creating a data driven unit test from a database table to supply the parameters...

Read More

Truncating Database Log Files

Discovered today that I needed to shrink some database files to retake some drive space on a SQL Server 2005 box. Shrinking the database and its files are relatively simple (right-click -> Tasks -> Shrink -> follow the wizard). However,...

Read More

DataTable.Load(SqlDataReader)

There are plenty alternatives and methods for filling a DataSet / Datatable. This one in particular is simple, easy and to the point. In often cases I usually hydrate custom objects for performance reasons, however for those times you need...

Read More

SqlDataReader with Multiple Result Sets

There are plenty of times when just a single query result of data returned just doesn't quite cut it. You end up creating a second stored procedure to return some additional information that could be summary info, corresponding column names...

Read More