Archive for the ‘SQL Server 2012’ Category

Spatial, Geography and Geometry, oh my! – Part 2: Spatial Data (continued)

October 11, 2012 2 comments

Last week, we started the Spatial Analysis series with an overview of the two-dimensional aspects of geometry.  Today, we’ll look into coordinate systems, which include both two- and three-dimensional mapping.
Read more…

Functions – A handy tool for formatting data (among other things)

October 9, 2012 Leave a comment

Last week we started Spatial with Part 1 of a series, and we’ll get back to that on Thursday.  Today, we’ll talk about functions.  Functions are a tool that can be used by developers to perform automated data replacement, concatenation, calculations or other tasks in a much easier way:  by programming a function, then simply calling that function for the field that needs to be calculated.   There are two types, system functions and User-Defined Functions (UDF’s).  This post is going to deal with UDF’s. Read more…

Spatial, Geography, and Geometry. Oh my! – Geospatial Data Part 1

October 2, 2012 1 comment

Geography and Geometry.  Gives me flashbacks to high school.  Though those would lead to interesting stories, today we’re here to discuss Spatial within SQL Server.   There are a lot of different uses for spatial, but it all boils down to the ability to represent SQL Server data on a map, either 3D or 2D.  Shall we begin? Read more…

Recursive Queries – Leveraging CTE’s to work for you

September 20, 2012 3 comments

Playing around with Microsoft SQL Server 2008 Express edition, I’ve sorted through a bunch of tidbits. One that I thought was interesting, is how to perform a recursive or hierarchical query. This describes how you can perform the magic.

The official name of the WITH clause in Oracle’s lexicon (otherwise known as Oraclese) is a subquery factoring clause. Microsoft has a different name for the WITH clause. They call it a Common Table Expression or CTE. You can find more on that in this earlier blog post.

Read more…

Triggers – Save yourself the extra coding and time with automation

September 18, 2012 Leave a comment

Triggers are an often overlooked feature of SQL Server that can automate a LOT of tasks, such as auto-update an activity flag, or auto-insert new rows based on a new row in a different table. Instead of being required to code 100 lines of code to add a new row to a table and update all dependent tables, a trigger can be set to execute on an Update, Insert, or Delete (DML Trigger), Create, Alter, Drop, Grant, Deny, Revoke (DDL Trigger), or even upon login (Login Trigger).  Today, we’ll cover the three different types and how they can be used to automate your database tasks. Read more…