Using triggers to protect your database from developers – still not a good idea

A long time ago I mentioned that triggers is rarely a good option in your database. I recently read this article (requires free registration) that shows you a solution to prevent developers from updating a full table (or deleting it all) by mistake because they failed to ad a WHERE clause to their query. Is this a good…


SQL server backup myths

Any kind of backups other than straight file copies have Always been magic to me. Mostly because in the early years of my career it was so rare that the backups actually worked when needed because nobody evern tried the backups to see if they were actually working… This post (free registration needed to read)…


SQL CLR Aggregates

I’m still waiting for the day I actually need to write my own aggregate for SQL server in managed code. This article (requires free registration to read) made me better prepared for that day.


The cost of a row in SQL Azure

If you ever want to know how much a row in your SQL Azure database would cost you if you did not pay a fixed price… You want to read this.


7 tips for faster SQL queries (are really just 5)

I like when people make lists of things and decide on how many things they want in the list before they actually make the list. Usually it means a few items on the list are not so good. And by coincidence I have found another list like that which is related to SQL and I’m…


Considering future performance in your database

Ten years ago I worked on a project where we did a lot of fancy things with a number of databases. I learned a lot during that project but I also heard a funny story a coworker told me: I was called in to fix a problem with an accounting system. The customer described the…


Handling different versions of the database

The only way to handle database changes I’ve used before was either a number of SQL scripts which usually was a pain since it was almost impossible to remember what version of the database you had so you never knew which of the scripts to run. A better method I’ve used was to use a…


How to prevent the use of "SELECT *"

One good tip for writing good SQL code is to always select the columns you need and never just select everything. Well here is a description on how to actually prevent SELECT * queries (you need to complete a free registration to see the article). The basic idea is to add a dummy column to…


SQL programming mistake #12

I would like to add another thing to my previous list. And that is the mistake of not properly understanding how to use correctly create the WHERE clause. I came to think about this when I read this which also includes a few good tips on how to rewrite your query to work more efficient.


SQL programming mistakes

I recently read this comprehensive list with ten common mistakes done when writing SQL. And I’d like to add number eleven to that list: using dynamic queries in stored procedures. Especially in projects with a lot of stored procedures for parts (or all) of the business logic there is often a few stored procedures with…