"I just tried restoring a copy of my database but now the original's in recovery" That was the panicked question that I was asked earlier today and as it's something that I've seen come up more than a couple of times, I thought I'd write up a lunchtime quickie to explain the issue. If you... Continue Reading →
sp_RestoreScript v1.1 Now Available
Holy Database Restores Batman, sp_RestoreScript 1.1 is now available in the Undercover Toolbox and at UNDERCOVER TOOLBOX: sp_RestoreScript – A Painless way to generate SQL Server database restore scripts. This update fixes an issue that we've found when running on SQL Servers prior to 2016.
Secret Codes And SQL Server, Part 2: Pimp Your Encryption Algorithms.
We had a little play around writing our own encryption algorithms and cracking them in Secret Codes And SQL Server, Part 1: Writing Our Own Encryption Algorithm and Cracking it. I thought I'd see if we can go a step further and start having a look at how we could take those basic ideas and try... Continue Reading →
UNDERCOVER TOOLBOX: When was my last backup taken?
One question that seems to come up on the forums again and again is, 'how can I see when my database was last backed up?'. There are always a bunch of answers and some very convoluted scripts thrown around. As a bit of a lunchtime quickie today I thought I'd share with you a script... Continue Reading →
Secret Codes And SQL Server, Part 1: Writing Our Own Encryption Algorithm and Cracking it.
After my last post on The Arcane Science of Bitwise Logic and SQL Server I was asked a couple of questions on where it's used so I thought I'd write a follow up post. At first I was going to write something on bitmaps but then a thought of another area where bitwise logic is... Continue Reading →
The Arcane Science of Bitwise Logic and SQL Server
Bitwise logic, it seems is one of those ancient areas of computing that's only remembered by those old guys that have been kicking around for years. But what is it and how can we use it in SQL? Before we start looking at bitwise logic and the bitwise operators, we need to have a quick... Continue Reading →
UNDERCOVER TOOLBOX: sp_RestoreScript – A Painless way to generate SQL Server database restore scripts.
(Latest Version 1.8 - 23 November 2020) I'm sure we've all been there, we need to restore a database to 11:34am, four days ago. What's the first step? To go off hunting down the relevant full and differential backups and then figure out what transaction logs we need to play in and in what order.... Continue Reading →
Joining Datasets Side by Side, in Their Natural Order When There’s No Common Key
Here's a little something that came up the other day, we've got a couple of tables which we need to join together but there's no common key to join on. How do we go about attacking this? As an example consider the following, we've got two comma delimited strings that we need to join together.... Continue Reading →
Generating Random Numbers For All Rows in a Query and Other Funky Stuff You Can Do With Them
UPDATE: Check out Generate a Random Number for Each Row in a Query {a better way} for an alternative method that I now use for generating random numbers using CRYPT_GEN_RANDOM Here's a lunchtime quickie for you all, this is something that I've seen asked on the forums plenty of times and always gets some quite... Continue Reading →
Database in ‘Recovery Pending’ After Transaction Log Backup
Here's a little issue that I came across last week and I thought I'd share my investigations with you. Users started to report that a database was inaccessible and when I had a look, sure enough the database was in 'recovery pending' state. That's odd, a database usually only goes into 'recovery pending' state at... Continue Reading →
