Where to store your backups

By Greg No comments

When you do a backup, whether it be full, differential or log, SQL creates a backup file that you have to store somewhere. You’ll need to decide for yourself where to store your backups based on your requirements for restoring. To work out where to store a backup, we need to work out what we’re […]

How much data can you lose?

By Greg No comments

If you manage data for a business, the biggest risk you should always consider is how much of this data am I going to lose if a disaster strikes? Your manager is always going to want to have 0 data loss, that everything saved is kept no matter how big the disaster. However, they are […]

Types of SQL Backups

By Greg No comments

SQL Server has 3 different types of built-in backups: Full, Differential and Log. When working out how you’re going to backup your database, you need to understand what the 3 different types are intended for, so you can work out what you need to do. Full A full backup is the simplest type to understand […]

Why Backup SQL Server?

By Greg No comments

I’m going to start a new series on backing up SQL Server. This was inspired by @Kendra_Little in one of her Dear SQL DBA podcasts In this series I want to work through why we need backups, how to do backups, and the different types of backups that you could do and why you would […]

Retrieve data at system time for multiple Temporal Tables

By Greg No comments

If you have multiple temporal tables that join together, can you retrieve the data from the temporal table at a specific point in time? We’ll find out by running a test. First up, let’s create 2 system versioned tables and put some data in them: Next, we’ll update both records which will add data to […]

What is Your “Why”?

By Greg No comments

Andy Leonard (@AndyLeonard) has asked this month on T-SQL Tuesday “Why do you do what you do?” I have two answers to this question. On one hand I do what I do because it pays the bills. I have a full time job working for a company here in Australia and it pays the bills […]

Using NoLock makes Read Committed Snapshot Isolation revert to Read Committed

By Greg No comments

While trying to debug performance for an application the other day, I noticed that the expected behavior for the application was to use Read Committed Snapshot Isolation level, however when a query was run it seems that it is running in isolation level Read Committed. Why the change? Testing the problem I’m using the Stack Overflow database […]

Aggregate Functions in an Update Statement

By Greg 3 comments

I often need to update a record with an aggregate of another table. It’s often a parent record that has a record of the sum of a column in all of it’s child records. It seems like a really simple case of having an update statement and setting the value of the column to the […]

String or Binary Data would be Truncated

By Greg No comments

  If you’ve every tried to import data into SQL from another source, or even if you’ve just tried to insert data from a user, odds are you’ve hit ths annoying string or binary data would be truncated error message. I hit it at my first full time job, trying to insert data into SQL […]

How does a Left Join affect an Inner Join

By Greg No comments

Knowing the difference between join types is a very important part of querying a database. The two main joins that I use each day are INNER and LEFT. INNER join means get me everything from table A that has a matching row in table B. LEFT means get me everything from table A and if […]