SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Stupid Coding Tricks

Can anyone here write a SQL statement that generates a Mandelbrot Set? I’m sure a few of you can, and if you want to try, please do so, but it’s something that I’m not particularly good at. I used to like solving problems like this in coding when I was a student, but now I know I can do many of them, and so it’s not really something that excites me.

However I do appreciate the effort and intelligence that goes into writing code like this. Over at TheDailyWTF, there is a post on someone generating a Mandelbrot Set in T-SQL. It’s a fairly short, single T-SQL command with a CTE that’s less than 50 lines.

If you want to see the results in notepad, here’s what they look like:

Give it a try if you like challenges, or view the code here.

The Voice of the DBA

Steve Jones is the editor of SQLServerCentral.com and visits a wide variety of data related topics in his daily editorial. Steve has spent years working as a DBA and general purpose Windows administrator, primarily working with SQL Server since it was ported from Sybase in 1990. You can follow Steve on Twitter at twitter.com/way0utwest


Posted by Phil Factor on 11 December 2008

I think it is lovely, Steve.

Posted by Steve Jones on 11 December 2008

Why am I not surprised? ;)

Posted by Jerry Hung on 12 December 2008

Aww, this is so sad in so many ways, but VERY COOL!

code took 36 secs to run on my SQL Server

For those who don't know Mandelbrot Set (myself included)


Leave a Comment

Please register or log in to leave a comment.