Loading Ordnance Survey open data into SQL Server, using the geography type

Ordnance Survey have been providing free to use mapping data and it’s great that this data is publicly available and regularly updated. As someone who works with SQL Server daily, I wanted to load this data into SQL Server, using the spatial types.

OS provide this data in the ESRI Shapefile format, which unfortunately is not supported by SQL Server out of the box. With a little bit of conversion, it’s still possible to load this data into SQL Server.

Continue reading  

Dont break the build – Commiting external files through Redgate Source Control

Redgate’s SQL Source control is a great tool for commiting database changes to your repository, however it has one major drawback, it doesn’t allow you to commit any changes in the repository that are outside of the database, such as your web application or reporting framework.

This means that any breaking changes to the database would require two commits to your repository, one for the database change using SQL Source Control and the other for any corresponding application changes. This results in a commit that breaks the build – something nobody wants in their version history!

Continue reading  

Dynamically adding columns and rows to a HTML table

Recently, whilst working on an ASP.NET project, I had the requirement to dynamically add rows and columns to any position within a HTML table. This turned out to be a little more complicated than I had hoped as adding rows or columns into the middle of the table is slightly trickier, but it’s easily achievable with a little bit of effort.

Fortunately, with some help from jquery and the html 5 data attributes it’s not difficult to insert a new row or column at any position within the table. The only caveat with my method is that it requires the table to start with the correct attributes, so we can select them with jquery.
Continue reading