THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Michael Coles: Sergeant SQL

SQL Server development, news and information from the front lines

You're a mean one...

Vince threw out a question - how did I create my geeky Christmas card at  For those who haven't seen it yet -- this is your spoiler alert -- go check it out before you read on.

The script in the blog draws a picture of the Grinch with the SQL 2008 Geometry data type.  Unfortunately the way I wanted to create it is a much better story than how I ended up making it.  Originally I wanted to take a Grinch image, write a little .NET app to read in the bitmap and convert all the image borders to vector graphics.  After I spent about 30 minutes working on the app to pick apart the raster image and find the edges I figured out it would be a heckuva lot easier to just fat-finger the coordinates in, especially for such a simple image.

I ended up just drawing a simple vector image of the Grinch in PaintShop Pro.  Then I opened up Excel and moved the mouse over every corner in the image and hand-keyed the coordinates into a spreadsheet.  I used Excel to create some concatenated string SELECT statements and copied/pasted it all into SSMS.

...Mr. Grinch 

I did find out pretty quickly, by the way (and yes, I should have known this), that the y-coordinates in the PaintShop Pro window are the opposite of the Geometry data type.  That is, (0, 0) is the upper left corner and the y coordinates increase as you go down in PaintShop.  So my original Grinch image actually printed upside down.  That's why you see all the negative numbers in the final script :)

Anyway the story of how I made it is a lot less interesting than how I *wanted* to make it :)

Published Wednesday, December 30, 2009 1:42 AM by Mike C

Attachment(s): grinch.png


No Comments
New Comments to this post are disabled

This Blog



Privacy Statement