A View Inside My Head

Jason's Random Thoughts of Interest
posts - 86, comments - 178, trackbacks - 22

April 2008 Entries

Project Euler Comes to Azeroth

It seems that a lot of my friends are doing Project Euler (according to my High School math teacher, this is pronounced "Oiler"). For example, Bill Wagner has been posting C# solutions, Darrell Hawley has ventured into the Python realm, and Dustin Campbell has been working on F# versions. I love numbers, and spent a good portion of one summer playing with primes and number fields just for fun (since then, I've discovered WoW, and that takes up all of my time that would otherwise be spent exercising my brain). Project Euler is actually right up my alley, and while in...

posted @ Thursday, April 24, 2008 9:38 PM | Feedback (1) | Filed Under [ Articles ]

SQL Server 2008: Spatial Data, Part 6

In the Part 4 and Part 5 of the series, I demonstrated some instance methods of the Geometry type that returned a new Geometry based on existing instances. In this part, I will concentrate on instance methods and properties of the Geometry type that return scalar values and Points. STArea, STLength Typically, your spatial data will represent something from the real world. A LineString may be the collection of points gathered from a GPS device, and together they may represent the path that you took from your home to the office. A Polygon may be the collection of points around the...

posted @ Friday, April 11, 2008 8:44 PM | Feedback (4) | Filed Under [ Articles .NET SQL Spatial ]

Using PIVOT and RANK Together

A friend of mine (name withheld, I didn't actually ask if I could blog this... ;-) asked for advice to what appears to be a simple problem until you try to implement it. Consider the following somewhat normalized table: AccountNum ...

posted @ Thursday, April 10, 2008 11:03 AM | Feedback (0) | Filed Under [ Articles SQL ]

SQL Server 2008: Spatial Data, Part 5

In the previous part of this series, I demonstrated instance methods that transformed a single Geometry type into another useful Geometry. In this post, we'll go a step further and show methods that allow two or more instances to interact with one another in order to produce a new Geometry. For my baseline, I'll use two Polygons that overlap each other: DECLARE @g geometry = 'POLYGON((10 10, 40 10, 40 40, 10 40, 10 10))' DECLARE @h geometry = 'POLYGON((30 30, 50 30, 50 50, 30 50,...

posted @ Monday, April 07, 2008 11:51 AM | Feedback (3) | Filed Under [ Articles .NET SQL Spatial ]

SQL Server 2008: Spatial Data, Part 4

In this, the 4th post in a series (Part 1, Part 2, Part 3) on the new spatial data types in SQL Server 2008, I'll explain some of the methods that are used to transform a single Geometry instance into another useful Geometry instance. Note that I'm using Geometry for simplicity, but these techniques also work with Geography. Edit: Ok, after starting to take a hard look at Geography, I realized that A LOT of the methods that Geometry offers are not implemented in Geography. :-/ Sorry to mislead you. Useful TipTo help me to visualize geometries as I explore the...

posted @ Thursday, April 03, 2008 8:31 PM | Feedback (9) | Filed Under [ Articles .NET SQL Spatial ]

Alternatives to CASE in T-SQL

In my job, I often come across SQL queries that include large CASE blocks. Often, the same decision logic is repeated for multiple columns within the query, making the SQL very verbose. Now, I don't really have an opinion about whether CASE blocks are good or bad practices; I tend to think that whatever works is the right choice, and if needed, you can always refactor and/or optimize later. However, there is usually a purely mathematical way to represent a CASE block as a single expression that may or may not improve performance and readability of the code. ...

posted @ Wednesday, April 02, 2008 2:32 PM | Feedback (1) |

Powered by: