Home of the AlmostImplementedException

May, 2013

SQL Server: Set query governor cost limit

Sometimes you will have the problem that you execute a long, time consuming query, e.g. in a stored procedure. In our case we’ve got a maintanance plan that executes a stored procedure to generate statistics everey day. But for this we will the following error on execution: “The query has been canceled because the estimated […]

TSQL: NULLIF and ISNULL or How to prevent Divide-By-Zero errors

When you do calculations in your database, you sometimes have to deal with null and 0 (zero) values. This can lead to Divide-By-Zero errors or null-results. To prevent them we can use ISNULL and/or NULLIF. Lets start with ISNULL. This simple fellow just needs two parameters. First the value to check and second the resulting […]