THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - 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

Merry Christmas

The script below generates the geekiest Christmas card in the world.  To see it, follow these instructions:

(1) Copy and paste the script below into SQL Server Management Studio 2008
(2) Execute the script
(3) Look at the "Spatial Results" tab in SSMS

Merry Christmas!

-- Begin copy here

SELECT geometry::STGeomFromText('GEOMETRYCOLLECTION(
 POLYGON(
  (169 -166, 118 -152, 93 -154, 45 -192, 39 -208, 35 -233, 37 -262, 45 -289, 42 -328, 44 -347, 53 -376, 60 -359,
   64 -337, 63 -314, 59 -301, 48 -289, 50 -269, 54 -246, 60 -230, 72 -216, 57 -217, 73 -213, 68 -196, 75 -192,
   72 -197, 75 -213, 77 -198, 88 -180, 80 -198, 77 -214, 85 -245, 103 -248, 99 -245, 100 -242, 103 -240, 112 -240,
   104 -238, 106 -227, 116 -214, 129 -209, 139 -213, 134 -210, 142 -204, 150 -204, 143 -201, 147 -196, 154 -194,
   164 -196, 156 -193, 158 -185, 163 -177, 173 -174, 166 -174, 171 -165, 169 -166)
  ),
 POLYGON(
  (281 -177, 289 -176, 296 -179, 302 -182, 307 -187, 283 -426, 275 -494, 275 -534, 122 -534, 127 -509, 134 -508,
   135 -518, 143 -525, 155 -523, 158 -517, 166 -520, 176 -517, 181 -511, 190 -510, 196 -502, 196 -494, 202 -491,
   204 -483, 204 -480, 211 -474, 213 -462, 219 -455, 221 -449, 217 -439, 219 -431, 219 -422, 214 -413, 238 -382,
   243 -364, 243 -342, 249 -321, 257 -289, 271 -214, 281 -177)
 ),
 POLYGON(
  (122 -534, 127 -509, 120 -504, 116 -500, 116 -486, 112 -486, 106 -509, 104 -534, 122 -534)
 )
)', 0)

UNION ALL
 
SELECT geometry::STGeomFromText('GEOMETRYCOLLECTION(
 POLYGON(
  (190 -207, 201 -214, 209 -226, 212 -235, 214 -278, 219 -294, 234 -317, 241 -342, 242 -355, 241 -366, 239 -380,
   234 -388, 224 -400, 212 -413, 194 -435, 187 -446, 180 -459, 172 -467, 162 -471, 153 -470, 144 -464, 136 -453,
   125 -439, 117 -426, 102 -412, 88 -400, 73 -384, 70 -371, 68 -356, 71 -342, 76 -331, 82 -321, 90 -309, 92 -293,
   93 -282, 103 -280, 131 -256, 167 -217, 186 -204, 190 -207)
  ),
  POLYGON(
   (319 -40, 321 -57, 324 -79, 318 -84, 312 -84, 312 -91, 306 -104, 297 -105, 288 -110, 288 -90, 281 -78, 278 -59,
    295 -45, 309 -36, 314 -36, 319 -40)
  ),
  LINESTRING(
   309 -96, 304 -98,300 -98
  ),
  LINESTRING(
   311 -84, 304 -72, 303 -64, 304 -54
  ),
  LINESTRING(
   302 -68, 296 -66, 294 -59
  ),
  POLYGON(
   (319 -40, 328 -37, 344 -37, 349 -40, 348 -52, 344 -58, 332 -59, 321 -58, 319 -40)
  ),
  POLYGON(
   (322 -59, 343 -59, 346 -66, 344 -75, 338 -84, 331 -83, 323 -80, 322 -59)
  ),
  POLYGON(
   (323 -81, 327 -83, 338 -85, 337 -96, 332 -101, 325 -104, 317 -103, 311 -97, 312 -84, 318 -84, 323 -81)
  ),
  POLYGON(
   (306 -120, 307 -129, 311 -134, 312 -140, 309 -152, 308 -168, 296 -161, 286 -161, 284 -156, 288 -130,
    294 -128, 306 -120)
  ),
  POLYGON(
   (154 -472, 156 -476, 158 -485, 156 -491, 153 -498, 159 -487, 176 -474, 183 -464, 185 -453, 179 -460, 171 -467,
    165 -470, 155 -471, 154 -472)
  )
)', 0)

UNION ALL
 
SELECT geometry::STGeomFromText('GEOMETRYCOLLECTION(
 POLYGON(
  (171 -165, 179 -159, 185 -160, 182 -157, 190 -147, 202 -144, 211 -148, 214 -157, 206 -168, 215 -160, 221 -168,
   221 -175, 206 -184, 221 -178, 229 -186, 228 -192, 221 -197, 228 -197, 231 -205, 225 -212, 218 -211, 222 -216,
   219 -226, 211 -231, 204 -218, 191 -208, 201 -205, 191 -205, 178 -209, 167 -218, 144 -242, 128 -260, 111 -274,
   98 -282, 85 -283, 95 -284, 91 -299, 81 -299, 74 -294, 67 -294, 60 -290, 59 -284, 61 -279, 54 -268, 58 -258,
   66 -253, 74 -253, 77 -257, 77 -252, 85 -245, 103 -248, 99 -245, 100 -242, 103 -240, 112 -240, 104 -238, 106 -227,
   116 -214, 129 -209, 139 -213, 134 -210, 142 -204, 150 -204, 143 -201, 147 -196, 154 -194, 164 -196, 156 -193,
   158 -185, 163 -177, 173 -174, 166 -174, 171 -165)
 ),
 POLYGON(
  (122 -435, 114 -439, 108 -445, 106 -456, 111 -460, 118 -455, 112 -465, 109 -473, 109 -482, 115 -486, 122 -479,
   116 -489, 116 -497, 119 -503, 125 -507, 132 -508, 136 -504, 134 -515, 140 -522, 152 -524, 158 -517, 158 -510,
   160 -517, 170 -519, 178 -514, 181 -507, 184 -510, 193 -509, 196 -501, 195 -493, 200 -493, 204 -486, 200 -475,
   205 -478, 210 -472, 213 -466, 212 -461, 209 -457, 214 -459, 218 -457, 220 -450, 215 -440, 218 -434, 218 -423,
   214 -417, 208 -417, 196 -434, 185 -453, 183 -465, 176 -474, 160 -486, 156 -491, 153 -498, 155 -490, 158 -484,
   155 -476, 153 -472, 146 -466, 139 -457, 122 -435)
 ),
 POLYGON(
  (271 -152, 280 -153, 285 -158, 286 -161, 289 -160, 296 -160, 304 -165, 310 -172, 319 -172, 325 -176, 327 -180,
   326 -187, 320 -192, 319 -198, 315 -202, 307 -203, 307 -188, 300 -182, 290 -178, 282 -176, 278 -185, 266 -185,
   263 -181, 264 -177, 269 -175, 262 -176, 258 -171, 259 -166, 262 -164, 269 -165, 264 -162, 265 -157, 271 -152)
 )
)', 0)

UNION ALL

SELECT geometry::STGeomFromText('GEOMETRYCOLLECTION(
 POLYGON(
  (316 0, 329 0, 324 -39, 318 -40, 314 -36, 316 0)
 ),
 POLYGON(
  (303 0, 316 0, 315 -36, 304 -40, 303 0)
 ),
 POLYGON(
  (307 -104, 311 -98, 321 -105, 332 -105, 340 -108, 346 -117, 345 -124, 347 -129, 344 -131, 343 -126, 338 -125, 330 -122,
   324 -117, 328 -122, 326 -128, 323 -132, 318 -134, 317 -139, 312 -133, 307 -130, 306 -124, 308 -119, 311 -112, 306 -119,
   301 -124, 293 -128, 288 -128, 288 -132, 284 -127, 283 -122, 284 -114, 291 -108, 301 -104, 307 -104)
 )
)', 0)

UNION ALL

SELECT geometry::STGeomFromText('GEOMETRYCOLLECTION(
 POLYGON(
  (151 -306, 146 -311, 135 -316, 125 -318, 116 -317, 110 -312, 106 -306, 119 -303, 136 -300, 151 -306)
 ),
 POLYGON(
  (137 -303, 144 -304, 146 -307, 144 -310, 138 -312, 133 -309, 132 -305, 137 -303)
 ),
 POLYGON(
  (161 -302, 165 -296, 178 -288, 188 -286, 203 -289, 205 -294, 204 -305, 202 -307, 182 -312, 171 -310, 164 -306,
   161 -302)
 ),
 POLYGON(
  (184 -291, 185 -296, 184 -301, 176 -306, 173 -304, 170 -300, 172 -293, 179 -290, 184 -291)
 )
)', 0)

UNION ALL

SELECT geometry::STGeomFromText('GEOMETRYCOLLECTION(
 POLYGON(
  (143 -439, 142 -434, 148 -425, 155 -420, 162 -418, 168 -418, 180 -427, 183 -432, 183 -435, 181 -436, 176 -430,
   168 -427, 159 -424, 149 -426, 143 -433, 143 -439)
 ),
 LINESTRING(
  161 -424, 160 -419
 ),
 LINESTRING(
  173 -422, 176 -430
 )
)', 0)

UNION ALL

SELECT geometry::STGeomFromText('GEOMETRYCOLLECTION(
 LINESTRING(
  151 -326, 147 -331, 147 -335, 157 -333, 160 -336, 164 -338, 168 -335, 171 -334, 180 -335, 179 -330, 174 -328
 ),
 LINESTRING(
  146 -332, 136 -344, 132 -357, 130 -373, 132 -396, 136 -410, 137 -419
 ),
 LINESTRING(
  168 -338, 170 -344, 171 -351, 167 -391
 ),
 LINESTRING(
  181 -333, 187 -342, 188 -351, 192 -375, 191 -401, 190 -417, 190 -440, 186 -443, 182 -445, 179 -443, 175 -438
 ),
 LINESTRING(
  138 -436, 140 -442, 143 -446, 153 -436, 157 -431, 160 -432
 ),
 LINESTRING(
  150 -413, 153 -410, 157 -407, 164 -404, 173 -406, 176 -410
 ),
 LINESTRING(
  139 -446, 148 -457, 152 -460, 157 -462, 162 -463, 168 -462, 175 -457, 180 -447
 ),
 LINESTRING(
  126 -352, 121 -357, 117 -368, 116 -376, 117 -390, 121 -402, 135 -437
 ),
 LINESTRING(
  105 -396, 113 -412, 118 -425
 ),
 LINESTRING(
  216 -388, 214 -403, 208 -416
 ),
 LINESTRING(
  198 -360, 202 -370, 202 -382, 200 -403, 194 -434
 ),
 LINESTRING(
  175 -316, 181 -317, 193 -316, 205 -313
 ),
 LINESTRING(
  177 -318, 189 -323, 199 -323, 214 -316
 ),
 LINESTRING(
  174 -320, 186 -330, 199 -334, 213 -330, 220 -321
 ),
 LINESTRING(
  157 -326, 162 -322, 171 -323
 ),
 LINESTRING(
  155 -320, 161 -317, 167 -318
 ),
 LINESTRING(
  154 -316, 160 -312
 ),
 LINESTRING(
  106 -318, 110 -321, 121 -326, 132 -323, 148 -313
 ),
 LINESTRING(
  99 -324, 108 -334, 119 -335, 137 -325, 150 -312
 ),
 LINESTRING(
  94 -335, 100 -344, 111 -345, 123 -339, 137 -330, 147 -321, 153 -311
 ),
 LINESTRING(
  105 -307, 88 -304
 ),
 LINESTRING(
  106 -309, 94 -313
 ),
 LINESTRING(
  207 -294, 221 -295
 ),
 LINESTRING(
  205 -291, 219 -289
 ),
 LINESTRING(
  206 -290, 205 -283, 202 -281
 ),
 LINESTRING(
  158 -298, 158 -284, 160 -278
 ),
 LINESTRING(
  158 -284, 154 -263
 ),
 LINESTRING(
  154 -258, 152 -244
 ),
 LINESTRING(
  151 -272, 148 -266, 144 -261, 138 -257
 ),
 LINESTRING(
  153 -291, 149 -282, 140 -271, 130 -265
 ),
 LINESTRING(
  158 -264, 161 -250, 165 -241, 170 -235, 175 -233
 ),
 LINESTRING(
  169 -266, 173 -254, 178 -244, 182 -237
 ),
 LINESTRING(
  196 -244, 204 -220
 ),
 LINESTRING(
  167 -292, 198 -242
 ),
 LINESTRING(
  168 -291, 199 -241
 ),
 LINESTRING(
  169 -290, 201 -240
 ),
 LINESTRING(
  170 -289, 202 -240
 ),
 LINESTRING(
  171 -289, 204 -242
 ),
 LINESTRING(
  172 -288, 205 -244
 ),
 LINESTRING(
  173 -288, 210 -250
 ),
 LINESTRING(
  175 -287, 212 -252
 ),
 LINESTRING(
  178 -286, 217 -254
 ),
 LINESTRING(
  152 -306, 119 -288, 101 -293
 ),
 LINESTRING(
  153 -306, 119 -287, 102 -291
 ),
 LINESTRING(
  153 -306, 119 -286, 102 -287
 ),
 LINESTRING(
  153 -306, 120 -284, 103 -286
 ),
 LINESTRING(
  154 -305, 121 -282, 104 -283
 ),
 LINESTRING(
  156 -304, 121 -280, 104 -283
 )
)', 0);

-- End copy here

 

Published Tuesday, December 22, 2009 4:59 PM by Mike C

Comments

 

DavidStein said:

You're a mean one... Mr. Grinch. Great article.

December 22, 2009 4:18 PM
 

merrillaldrich said:

Why is he purple? He's supposed to be green.

December 22, 2009 5:00 PM
 

mjswart said:

Fantastic-ness.

Just Great.

Merry Christmas to you too.

December 22, 2009 5:01 PM
 

mjswart said:

Fantastic-ness.

Just Great.

Merry Christmas to you too.

December 22, 2009 5:05 PM
 

philnolan said:

"I'm all toasty inside. And I'm leaking."

Great work Michael.

December 22, 2009 5:40 PM
 

hodge said:

Tah is just way too cool!  Thanks!

December 23, 2009 7:57 AM
 

Vijaya Kadiyala said:

This is fantastic.

December 23, 2009 10:02 AM
 

ALZDBA said:

I think Santa needs recovery ;)

Merry Christmas to you all !

December 23, 2009 10:38 AM
 

drsql said:

Wow, that is pretty awesome. Much more geeky than my post where I just used cast to turn strings into varbinary.

Very cool. Merry Christmas!

December 24, 2009 7:48 PM
 

Vince said:

Neat. For something really interesting, share how you figured this out.

December 28, 2009 10:47 AM
New Comments to this post are disabled

This Blog

Syndication

News

Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement