Small code with powerful results, the occasional opinion … and beer.

16 Mar 2012
SQL Server: reclaiming the bloated modellog.ldf file

I was working on a virtual test server with a very small (7Gb) C: drive, and the monitors were throwing alerts about low disk space. There weren’t any temp files, etc, that could be deleted to quickly free up space.  Tree Size revealed that there was a 3.5Gb file named modellog.ldf, which was clearly bloated […]

11 Feb 2010
SQL Server, Integrated Authentication, and “To Tell the Truth”

Moderator: “Login number one, what is your identity?” Number one: “I am known as jsmith” Moderator: “Login number two, what is your identity?” Number two: “I am known as jsmith” … and after all the contestants would make the same claim, the moderator on “To Tell the Truth” would then give some background on the […]

09 Sep 2009
The lost art of break and continue

BREAK and CONTINUE are two forms of loop control, which I have seen under-used lately.  I think it is time to revisit how these two statements can help you make more maintainable and readable code, with some basic comments where needed. BREAK is used to prematurely exit a loop sequence, be it a WHILE loop, […]

30 Sep 2008
Anti-Collision Work Queue Retrieval: an approach using GUIDs

I recently wrote a high-volume, fast paced application which supports many threads reaching into a work queue (SQL table) and retrieving a row representing a piece of work.  The table uses an identity column as its primary key. In other work experiences, I have seen SQL locking hints used to prevent two threads from grabbing […]

25 Sep 2008
Triggers in SQL Server: how often are they called

Our dba and I had a short discussion on triggers, because I could not locate an answer to this question: When inserting, updating or deleting more than one row in a table, is the trigger fired iteratively for each affected row, or once with all the records in the inserted and deleted tables? To me […]