Have you ever needed to store the results of a complex query in a temp table? How did you go about working out what the definition for that temp table should be, the columns and their data types? It can be a bit of a pain, not to mention time consuming to have to go... Continue Reading →
Building an IN list using REPLACE
Have you ever had the need to build an IN list from some rows you had in excel? Or maybe you have a bunch of data you pulled out of a results set from some other server somewhere and you are unable to join tables so you need to plug the values into an... Continue Reading →
UNDERCOVER TOOLBOX: sp_ChangeDatabaseOwnership – Producing statements to Alter Authorisation
The latest addition to our toolbox is not a one size fits all, this procedure may or may not suit your needs but if you have a requirement of setting database ownership's to a specific login across the board such as SA, then this Stored procedure may well be for you. The idea of... Continue Reading →
View your Failover Cluster from the DMV’s
Just a quick post this time , I was fumbling around the DMV's the other day looking for a specific Availability group DMV that I just couldn't remember the name of - I think we have all been there before with some of the DMV names! 🙂 Whilst I was combing through various combinations of... Continue Reading →
SSMS- Source Database ‘Restoring’ After Performing a Restore To a New Destination
"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 →
UNDERCOVER TOOLBOX: Sp_RunningJobs – See all currently running SQL Agent Jobs
Update: 07/08/2017 - Identified and fixed a bug with the Elapsed Days not showing accurately. Update: 31/7/2017 - We have improved the Stored Procedure, the revised version now includes Days elapsed in addition to Hours, Minutes and Seconds. There are quite a few Running agent job scripts out there , most of the ones I... 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 →
Scripting out SQL Server Objects without the GUI
I quite often find myself scripting objects out via T-SQL rather than using the GUI, it's not that I have anything against using the GUI to script out a Stored procedure, it's just that sometimes this can be time-consuming especially when there are alot of stored procedures in the Programmability folder. I know that... 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 →
