Categories
SQL Server

Dealing with Multiple Database Snapshots

Last week we looked at using Database Snapshots to help with rolling back upgrades. The snapshot maintained a point in time copy of the database which could be later restored. We can go further – a database can have multiple snapshots. Let’s suppose we want to take one before an upgrade, another once the upgrade is […]

Categories
SQL Server

Using Database Snapshots for Peace of Mind Upgrades

Deploying database changes are relatively easy. Where things get complicated is the rollback. Sure, it’s easy to script out and revert a procedure to a previous version, but what about destructive changes? In this post we’ll look at how we can use Database Snapshots to remove some of the headache that comes with rolling back […]

Categories
SQL Server

Multithreaded Concurrency Essentials

Recently we looked at single threaded concurrency in SQL Server for workloads which only need a single core to execute. We saw how they ran at the same time with the queries effectively being round-robined on the CPU. This time out I wanted to look at how the concurrency looks when we’re working with multithreaded workloads. Setting […]

Categories
SQL Server

Demonstrating Concurrency in SQL Server

The question for today: if we have three queries – one which takes 1 second to run, one which takes 2 seconds to run, and one which takes 3 seconds to run – how long will it take to return data for the first and last query if they all start at the same time? […]

Categories
SQL Server

SSMS Productivity Boost with Multi Line Editing

One of the most time consuming tasks in Management Studio is repeating the same changes across multiple lines of a query. The answer to this? – Multi Line (or Column Mode) Editing. Here’s a quick post to explain what it is, how to do it, and examples to see it in action. What is multi […]

Categories
SQL Server

Object Visibility: Who Can See What

When developing database solutions we’ll typically spend some time considering security requirements, which will result (in part) with database roles being assigned to users or groups of users. Whilst security considerations will likely be focused on what folks can do in our databases, there’s a separate impact on what they can see in them too. I’ve had more than […]

Categories
SQL Server

Persisting Data Following Rollback

We recently looked at the impact of rolling back transactions on statistics and I thought it would be worth following this up to look at some other objects to see how they behave when a rollback occurs. When rolling back transactions we expect any changes to be rolled back. This isn’t always the case with data, just […]

Categories
SQL Server

Impact on Statistics of Rolling Back Transactions

I recently saw an Office Hours (at sea) Q&A from Brent where he was asked if statistics were rolled back along with a transaction. It’s a great question which I’d never come across so thought it would be worth looking into. TL;DR: They aren’t, but they may need to be updated when the data is next queried. […]

Categories
SQL Server

Modifying Data in Multi Table Views

Last time out we looked at modifying data in a view, but this only worked when we had a view referencing a single table. Here we’ll look at how we can achieve the same result for a view which references multiple tables. This one will require a little more work for us in the form of some extra […]

Categories
SQL Server

Modifying Data in a View

A view can be created in SQL Server to allow data to be presented in a specific way for a particular user or use case which may need to consume it. Recently I came upon a feature which I hadn’t been aware of throughout my career around SQL Server – you can perform data modifications […]