Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
The Voice of the DBA
 

Rollback vs. Roll Forward

The Advocates at Redgate Software had an interesting discussion about deployments in databases and how you go forward or back from the point at which you discover a problem. You can watch the episode, but a few things occurred to me while we were having our discussion.

The first thing is we all agree data makes things hard. A database is a stateful object, and dealing with stateful objects is hard. That is one of the things I’ve internalized the last few years that has tremendously changed how I work with Redgate customers. The more I consider state, the more I am able to work with the challenges that databases bring.

The second interesting thing from the episode for me was that each of us had a tendency for what to do. Do you tend to aim to get to a previous state or move to a new state? Each of us had a preference.

I think lots of us aim for a new state, mostly because we’re optimistic about our ability to “fix” the broken thing. I also don’t think this is a DBA, engineer, or technology thing. I find lots of people in the real world making mistakes and thinking they can do a new thing to fix the situation. Mechanics, lawyers, doctors, plumbers, they all think they can roll forward to a new state.

What’s occurred to me is that the people I know who are very much in demand for their skills and expertise are often the ones with a tendency to roll back to the previous state. They acknowledge the mistake and undo it. I’ve seen people in construction and other professionals also try to go back to the previous state when they realize they are in a situation where their fix didn't work, and they abandon that plan.

In the DBA world, we might prefer this even when our deployment caused data changes. We often will save data, roll back, and then decide what to do. This often means reconciling data, which isn't a fun task, but a necessary one.

Watch the episode and decide what your tendency is for adjusting for changes. Do you think about patching the issue and rolling forward? Or do you want to roll back to a known state and re-test our changes in a lower environment.

Steve Jones - SSC Editor

Join the debate, and respond to today's editorial on the forums

 
 Featured Contents
SQLServerCentral Article

Foreign Keys - Foes or Friend?

utsav from SQLServerCentral

Learn about how those Foreign Keys can impact your performance.

External Article

Find Duplicate Rows in SQL Server with a CTE

Additional Articles from MSSQLTips.com

This tip demonstrates how find and list allf duplicate rows in a dataset using a Common Table Expression (CTE).

Blog Post

From the SQL Server Central Blogs - A bespoke reporting solution doesn’t have to cost the earth

ChrisJenkins from Chris Jenkins' Blog

You could be tolerating limited reporting because there isn’t an off the shelf solution that meets your needs and you’re scared about the costs of a fully bespoke reporting...

Microsoft Power BI Performance Best Practices: Learn practical techniques for building high-speed Power BI solutions Microsoft Power BI Performance Best Practices

Steve Jones - SSC Editor from SQLServerCentral

In a world dominated by data, organizations heavily rely on business intelligence tools like Power BI for deriving insights and informed decision-making. Yet, as data volumes grow and user demands increase, achieving optimal performance becomes challenging.

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

Fun with JSON I

I have some data in a table:
CREATE TABLE #test_data
(
    id INT PRIMARY KEY,
    name VARCHAR(100),
    birth_date DATE
);

-- Step 2: Insert rows  
INSERT INTO #test_data
VALUES
(1, 'Olivia', '2025-01-05'),
(2, 'Emma', '2025-03-02'),
(3, 'Liam', '2025-11-15'),
(4, 'Noah', '2025-12-22');
If I run this query, how many rows are returned?
SELECT *
FROM OPENJSON(
     (
         SELECT t.* FROM #test_data AS t FOR JSON PATH
     )
             ) t;

Think you know the answer? Click here, and find out if you are right.

 

 

 Yesterday's Question of the Day (by Steve Jones - SSC Editor)

A Quick Restore

While doing some testing of an application, I wanted to reset my environment after doing some testing with this code:

USE DNRTest

BACKUP DATABASE DNRTest TO DISK = 'dnrtest.bak'
GO
/*
Bunch of stuff tested here
*/RESTORE DATABASE DNRTest FROM DISK = 'dnrtest.bak' WITH REPLACE

What happens if this runs, assuming the "bunch of stuff" isn't anything affecting the instance.

Answer: This returns an error, and the database isn't restored

Explanation: This returns an error:

Msg 3102, Level 16, State 1, Line 5
RESTORE cannot process database 'DNRTest' because it is in use by this session. It is recommended that the master database be used when performing this operation.
Msg 3013, Level 16, State 1, Line 5
RESTORE DATABASE is terminating abnormally.

Ref: RESTORE - https://learn.microsoft.com/en-us/sql/t-sql/statements/restore-statements-transact-sql?view=sql-server-ver17

Discuss this question and answer on the forums

 

 

 

Database Pros Who Need Your Help

Here's a few of the new posts today on the forums. To see more, visit the forums.


SQL Server 2019 - Development
Which 'Where' statement conditional upon a variable - Thanks in advance for any clues on this. I am trying to write a 'conditional where' statement in a typical select statement. Early in the stored procedure the variable @Type is set to either 'AB or 'CD'. I'm trying to have my WHERE be dependent on that variable e.g.: WHEN @Type = 'AB' my "WHERE" […]
Integration Services
Foreach Loop still executes after process and delete all the folders - I have two challenges XML source control not displaying the XML file parent node columns even though it is showing in the XSD file. Is there any solution to get the XML parent nodes columns in the XML source component. Foreach loop container control not stopping. it still executes if more than two files in […]
Editorials
Can You Let Go of Determinism - Comments posted to this topic are about the item Can You Let Go of Determinism
Doing Good at SQL Server Central - Comments posted to this topic are about the item Doing Good at SQL Server Central
Engineer Lessons - Comments posted to this topic are about the item Engineer Lessons
Article Discussions by Author
Lots of FKs - Comments posted to this topic are about the item Lots of FKs
Real-time On-prem SQL Server Data in Excel – Over the Internet - Comments posted to this topic are about the item Real-time On-prem SQL Server Data in Excel – Over the Internet
The day-to-day pressures of a DBA team, and how we can work smarter with automation and AI - Comments posted to this topic are about the item The day-to-day pressures of a DBA team, and how we can work smarter with automation and AI
Missing the Jaro Winkler Distance - Comments posted to this topic are about the item Missing the Jaro Winkler Distance
25 Years Later: What SQLServerCentral Meant to Me - Comments posted to this topic are about the item 25 Years Later: What SQLServerCentral Meant to Me
Fun with JSON - Comments posted to this topic are about the item Fun with JSON
Creating JSON II - Comments posted to this topic are about the item Creating JSON II
SQL Server 2022 - Development
AllocationType as ROW_OVERFLOW_DATA - Hello, I inherited a number of tables with like 20-30 column using nvarchar(256) in each of the tables, when, in fact, the values stored in those tables are way less than 256. So the Actual Size of each row in those tables is way less then 500, but when I run below queries for my […]
connections vs apis - hi , i hear more and more that we have too many connections to our servers.    many are sql.   many arent. so we are told to use api's where possible. Isnt there a connection behind the scenes when an api is asked to return data from whatever the erp's database is>
is it true we cant debug c# scripts in ssis anymore under vs - Hi, i'm running vs2022.   I'm trying out a c# script that i'd like to set breakpoints on to trap the exception that gets thrown when i debug.  From what i'm reading, i cant debug it because my runtime bitness is 64 and that setting cant be changed (it is greyed for me) in vs2022. is […]
 

 

RSS FeedTwitter

This email has been sent to {email}. To be removed from this list, please click here. If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com. This newsletter was sent to you because you signed up at SQLServerCentral.com.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -