Jul 262012
 

Splitting strings is an alarmingly common requirement, and there handfuls of solutions out there – the differences between them can be a couple of lines or a completely different architecture. In this post, SQL Sentry's Aaron Bertrand (@AaronBertrand) looks at some of the more common options and compares their performance in a variety of common scenarios.

Continue Reading »
Jul 242012
 

I see a lot of advice out there that says something along the lines of, "Change your cursor to a set-based operation; that will make it faster." While that can often be the case, it's not always true. One use case I see where a cursor repeatedly outperforms the typical set-based approach is the calculation of running totals. This is because the set-based approach usually has to look at some portion of the underlying data more than one time, which can be an exponentially bad thing as the data gets larger; whereas a cursor – as painful as it might sound – can step through each row/value exactly once.

Continue Reading »