Honest Fast Food

24 December 2011

In a change from our usual program … The thought of honest fast food in Senayan City in Jakarta made me smile… To be fair, I’m told by a friend that lives here that despite the name, the burgers are actually quite good.

Read the full article →

Advanced Database Unit Testing with tSQLt – Testing cross-database tables

20 December 2011

This is the first in an occassional series of articles covering more advanced ways of getting the most out of the tSQLt database unit-testing framework. One of the features of this framework I really like is the ability to fake or mock a table. FakeTable temporarily re-names the “production” table then creates an empty copy […]

Read the full article →

T-SQL Tuesday #025 Tips and Tricks

13 December 2011

This month’s T-SQL Tuesday is hosted by Allen White (blog | twitter) with a theme of Tips and Tricks.  Choosing what to write about is not as simple as one might think (at least for me), we all have little tricks up our sleeves but the question is which of these would be useful to […]

Read the full article →

Unit Testing Databases with tSQLt Part 6 – testing a SELECT stored procedure

7 December 2011

In Part 5, we looked at writing tests to prove that one stored procedure calls another and how test-driven development can help us refactor code. In Part 6 we are going to write some initial tests for a stored procedure that returns data as part of the Log4TSql open source logging library for SQL Server 2005+ […]

Read the full article →

Unit Testing Databases – Adapting the Test Data Builder Pattern for T-SQL

30 November 2011

One of the bigger obstacles to practising test-driven development, can be the perceived pain of building complex objects over and over again. This can be particulalrly frustrating when you have to construct an object with lots of attributes, most of which are irrelevant to any single test. For this reason, I am a fan of […]

Read the full article →

How to print very long strings and procedures

23 November 2011

Aaron Bertrand (blog | twitter) posted recently about the benefits of the OBJECT_DEFINITION() function when compared to INFORMATION_SCHEMA.ROUTINES when trying to search for a particular string in a very long procedure. He highights how useful the OBJECT_DEFINITION() function and sys.modules DMV are when searching for words or object references in such long SQL modules.  OBJECT_DEFINITION() […]

Read the full article →

Unit Testing Databases with tSQLt Part 5 – testing that a procedure calls another procedure

18 November 2011

In Part 4, we implemented some tests for a simple INSERT procedure with output parameters and wrote the code to pass those tests – ExceptionHandler. In Part 5 we are going to extend ExceptionHandler to collect even more information by calling another stored procedure and use our tests to make sure that ExceptionHandler calls that […]

Read the full article →

T-SQL Tuesday #024 – Exception Handling made simple

8 November 2011

I’ve been developing and using a simple logging framework for SQL Server on nearly every project I’ve worked on for the last five years, always with the intention of making it available for public use. That framework is Log4TSql and this month’s T-SQL Tuesday finally prompted me to put together a proper build on Sourceforge. […]

Read the full article →

Unit Testing Databases with tSQLt Part 4 – testing an INSERT stored procedure

2 November 2011

In Part 3, we completed the tests for the Exception table which will store SQL Server exceptions as part of the Log4TSql framework. In Part 4 we are going to put together some unit tests for the stored procedure that will populate the Exception table. The user stories we are addressing today are “As a […]

Read the full article →

Unit Testing Databases with tSQLt Part 3 – testing table constraints

29 October 2011

In Part 2, we looked at the first couple of tests for a new table; that it exists and with the correct structure (columns, data types etc). In this part we are going to write the rest of the tests we need to cover this table effectively. We will be validating the primary key, the IDENTITY […]

Read the full article →