About james duggan

Posts by james duggan:

SQL Unit Testing – dynamic connection configuration

I have recently joined the SQL unit testing bandwagon and love it, especially the pretty instant feedback when a code change impacts some other area in an unexpected way. Until now I have liked to believe I developed quality code, however in the face of a plethora of tests, I have to accept that was […]

SSDT SQLCLR integration : a case of the cart before the horse

I’ve very recently needed to delete an XEvent session’s asynchronous file target as part of tearing down the session. Native support is non-existent. What better than a simple SQLCLR stored proc. Having first tried to accurately derive the file name from the session created time based on details by Jonathan Kehayias’ (blog) post an-xevent-a-day-6-of-31-targets-week-asynchronous_file_target, I […]

My spaced used scripts

I suppose everyone has a set of scripts they lean on to help make sense of it all. These scripts are my version of sp_spaceused, one to query a specific table and the other at db level. Admittedly these are rough around the edges, that said they quickly allow me to break down a table […]

Please use my filtered index

Not long ago we had a requirement to timeout asynchronous application tasks not completing within an expected period (defined per task type). There is a high hit rate on the table with the number of pending modules at any one time in the 100s, and for this reason timeout processing needed to cause minimal blocking […]

An application generated sequential GUID

Recently one of our development teams implemented a GUID based on this SqlGuid Structure. Initially I did not give much thought to the implementation, however later during a code review, noting the choice of uniqueidentifier as the primary key, I began to join the dots. Clearly this is meant to be sequentially generated, and leaving […]