SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

The Database Avenger

My name is James Anderson and I am a SQL Server production DBA in the south of the UK. I have been working with databases since 2008. The first RDBMS I worked on was Paradox and I never want to see it again. I quickly moved to using T-SQL in SQL Server 2005. I have worked on every version of the product since. I enjoy query tuning and server optimisation. I detest transactional replication.

Archives: May 2016

Deletes Ignore Check Constraints

I know it sounds a bit odd but DELETE statements really do ignore table constraints. Running the code below in a test database will setup a test to prove this.

CREATE TABLE ProductConstraintTest
  ProductID	INT IDENTITY(1,1),
  ProductCode	VARCHAR(50),
  ProductName	VARCHAR(100),
  Cost		DECIMAL(19,4),
  Price		DECIMAL(19,4)

CREATE FUNCTION chkProductCount()…

Read more

10 comments, 3,243 reads

Posted in The Database Avenger on 30 May 2016

Broken Update With Join

Last month I wrote a post titled Broken Left Join which covered an easy to make mistake that I see fairly regularly when reviewing code. This month I’m covering UPDATE statements that run into trouble because of JOINs.

Updates with joins are not covered by the ANSI standard. To see… Read more

0 comments, 1,661 reads

Posted in The Database Avenger on 18 May 2016

Minimum Memory Grant Query Hint

This month Wendy Pastrick is the host for T-SQL Tuesday #78. This month we have to “learn something new and blog about it.” There is likely to be a lot of coverage on the new features in SQL Server 2016, so I have decided to cover a new feature that… Read more

4 comments, 2,139 reads

Posted in The Database Avenger on 10 May 2016