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: April 2016

Cumulative Updates Every 2 Months

The SQL Server team is implementing an Incremental Servicing Model (ISM) to deliver updates for SQL Server. This is basically a fancy way of saying: Cumulative Updates (CUs) will no longer be shipped when the team feel it’s required, instead a new CU will ship every 2 months.

This scheduled… Read more

0 comments, 468 reads

Posted in The Database Avenger on 25 April 2016

Broken Left Join

Here is a simple example of a LEFT JOIN that returns the sales stats for all employees under 21.

SELECT e.Name, COUNT(s.SaleId) AS Sales, MAX(s.DateOfSale) AS LatestSale

FROM Employees e
LEFT JOIN Sales s ON e.EmployeeId = s.EmployeeId

WHERE e.Age < 21


This will return all employees… Read more

2 comments, 416 reads

Posted in The Database Avenger on 21 April 2016

Partition Switching #TSQL2SDAY #77


The ALTER TABLE..SWITCH command allows you to almost instantly move large amounts of data from one table to another. It does this by not physically moving the data but by updating the meta data that points to the data. I have found many uses for this statement in the… Read more

5 comments, 3,590 reads

Posted in The Database Avenger on 12 April 2016