Worth Corner, Crawley, RH10 7SL

Support Hours - Mon-Sat, 8.00-18.00

Welcome to our SQL Server blog

This blog was created in order to pass on some of our knowledge and advice in the hope that the community might find it useful.

Obviously Microsoft SQL Server is our area of expertise and therefore this is our most thorough blog with everything from the basic through to the the incredibly advanced and, as such, we should have something for everyone within our pages.


Merry Christmas
Published: Sep 18, 2016
Well, based on some relatively recent posts I’m pretty sure you can all guess what this will be… it’s Christmas and therefore we need a Christmas drawing!!!

Okay, it’s not going to win any awards, but it’s Christmassy and that’s what counts…

Merry Christmas!!!

declare @shapes table
(
      
id int identity,
      
shape geometry
)
while (select count(*) from @shapes) < 2
begin
insert into
@shapes
select geometry::STGeomFromText
(
'multipolygon
(
((0 0, 0 1, 1 1, 1 0, 0 0))
)'
, 0)
end
insert into
@shapes
select geometry::STGeomFromText
(
'multipolygon
(
((0 0, 0 50, 50 50, 50 0, 0 0))
)'
, 0)
union all
select geometry::STGeomFromText
(
'multipolygon
(
((0 24, 0 26, 50 26, 50 24, 0 24)),
((24 0, 26 0, 26 50, 24 50, 24 0)),
((24 24, 24 26, 26 26, 26 24, 24 24)),
((24 50, 9 56, 11 56, 25 50, 24 50)),
((9 56, 9 58, 11 58, 11 56, 9 56)),
((9 58, 12 60, 14 60, 14 58, 9 58)),
((14 60, 25 50, 14 58, 14 60)),
((25 50, 41 56, 39 56, 26 50, 25 50)),
((41 56, 41 58, 39 58, 39 56, 41 56)),
((41 58, 38 60, 36 60, 36 58, 41 58)),
((36 60, 25 50, 36 58, 36 60))
)'
, 0)
while (select count(*) from @shapes) < 23
begin
insert into
@shapes
select geometry::STGeomFromText
(
'multipolygon
(
((0 0, 0 1, 1 1, 1 0, 0 0))
)'
, 0)
end
insert into
@shapes
select geometry::STGeomFromText
(
'multipolygon
(
((70 0, 55 40, 155 40, 140 0, 70 0))
)'
, 0)
while (select count(*) from @shapes) < 25
begin
insert into
@shapes
select geometry::STGeomFromText
(
'multipolygon
(
((0 0, 0 1, 1 1, 1 0, 0 0))
)'
, 0)
end
insert into
@shapes
select geometry::STGeomFromText
(
'multipolygon
(
((100 40, 100 70, 110 70, 110 40, 100 40))
)'
, 0)
while (select count(*) from @shapes) < 31
begin
insert into
@shapes
select geometry::STGeomFromText
(
'multipolygon
(
((0 0, 0 1, 1 1, 1 0, 0 0))
)'
, 0)
end
insert into
@shapes
select geometry::STGeomFromText
(
'multipolygon
(
((15 70, 45 110, 35 110, 65 150, 145 150, 175 110, 165 110, 195 70, 15 70)),
((55 150, 85 190, 75 190, 105 230, 135 190, 125 190, 155 150, 55 150))
)'
, 0)
union all
select geometry::STGeomFromText
(
'multipolygon
(
((102 228, 104 240, 105 240, 90 225, 98 245, 82 255, 100 255, 105 275, 110 255, 128 255, 112 245, 120 225, 105 240, 106 240, 108 228, 102 228))
)'
, 0)
select *
from @shapes
order by id


Leave a Comment
Your email address will not be published. All fields are mandatory.
NB: Comments will only appear once they have been moderated.

SQL  World  CEO
Kevin  Urquhart

iPhone Selfie

I am a SQL Server DBA, Architect, Developer, Trainer, and CEO of SQL World. This is my blog in which I’m simply trying to share my SQL knowledge and experiences with the world.

Categories


© Copyright 2020 SQLTraining Ltd.