Category Archives: SQL

ORM techniques for legacy databases

One of the reasons folks typically go with a hand-rolled ORM (i.e., using ADO.NET by hand) is the assumption that ORMs don’t work well with legacy databases or databases designed in isolation from any sort of object model used to … Continue reading 

Also posted in Architecture, NHibernate | 22 Comments

Hitting the upper limit of foreign key constraints

There are bugs, and then there are bugs.  We recently hit one that fell directly in crazy-town category.  What exactly would you do if you get this fun message: The query processor ran out of stack space during query optimization. … Continue reading 

| 17 Comments

Viewing all foreign key constraints in SQL Server

This one goes in the “so I never have to look again” category.  I needed to get a list of all foreign keys in the database, for some reason which was probably dire but now escapes me.  This guy had … Continue reading 

| 4 Comments

Designing primary keys

When creating a primary key for a table, we have a few options: Composite key Natural key Surrogate key Each has their own advantages and disadvantages, but by and large I always wind up going with the last option. Composite … Continue reading 

Also posted in Domain-Driven Design | 23 Comments

Calling .Net Web Services from Oracle PL/SQL

I’m working relatively closely these days with an Oracle DBA on this super-cool mainframe integration project (anyone want to join me?  LOL).  The old batch ops were managed through cron’d jobs in Oracle and I was asked to take a … Continue reading 

Also posted in Team Build, VSTS | Leave a comment