Joe Celko recently published a challenge to implement Conway’s Game of Life in SQL. At the start of this game, each cell of a 10×10 grid is either occupied or unoccupied by an imaginary creature that Celko calls a Merkle. Each turn, Merkles that have fewer than two neighbors die of loneliness while Merkles that […]

Over at the SQL Server Central forums, I just answered a question about the RAISERROR function in SQL Server 2008R2 and earlier versions. The original poster wanted to use RAISERROR in a CATCH block (after some logging, etc.) to return the original error to the calling application and halt further processing. Unfortunately, RAISERROR behaves much differently when used […]

*** Update – see the comments below for a solution to an issue with unexpected CR/LF characters in the XML file generated with this method. Thanks to reader Anthony for diagnosing the issue and providing the solution. *** A recent project at work included a requirement to generate a well-formed XML file from the output […]

Last week, a front-end developer came to me with an interesting problem. He had written some code that called a stored procedure t0 insert a row in a table that included a [ScheduledOn] column that was set to NULL by the insert and return a GUID value generated in the process, then immediately called a […]

I’ve posted my presentation materials for my session “Mayday! Applying Lessons Learned From Airline Disasters to Avoid Database Disasters” here: PDF – Grayscale – approx. 2 MB download PDF – Color  – approx. 10 MB download

I suspect SQL Server developers and DBAs spend very little time thinking about data types, probably because SQL Server generally is so forgiving about data types. SQL Server will, without complaint, perform implicit conversions whenever it can to match input data types to the defined data types of columns and variables and the specified data types for […]

This first post in a series of posts on “Things That Make You Go ‘D’oh’” – those little “gotchas” in SQL Server’s inner workings that lead to epic facepalms when developers and DBAs finally discover the sources of the problems they cause – explains the issue that inspired me to write this series. I had written a […]

I recently spent more time than I’d care to admit troubleshooting a T-SQL query that seemed to run fine most of the time but occasionally returned an error that, on the surface, didn’t make any sense. As I ruled out several of the more obvious possible causes, the error became one of those things that […]

I’m speaking at SQL Saturday #272 in Nashville, TN on January 18, 2014. My session is based on a presentation by Mike Walsh at PASS Summit 2013. Hope to see you there!

My last post described a trap for the unwary when using latitude and longitude values stored as the float data type in SQL Server, which left me wondering why anyone would use the float data type for this purpose. I questioned whether the float data type offers any advantages over the exact numeric types (decimal […]