Photo by Pixabay on Pexels.com This was an interesting question that I was asked yesterday and something that I'd never really thought of before. Can you delete the top x number of rows based on an ORDER BY? Why would you want to do that? Well let's just assume that we have a 'people' table... Continue Reading →
Attach All SQL Datafiles in a Directory
Have you ever had the need to attach a large number of database in one go? There's no way to attach multiple databases in SSMS or via script, so you're probably going to be left with the slow, arduous task of doing them one by one. I recently had to deal with a DR situation... Continue Reading →
Opening your SQL Backup Folder using Powershell
Sometimes I find remembering where a particular server sends its backups to a nightmare. You might have servers backing up to different locations, you might have different locations for individual databases and different locations for your fulls, diffs and logs. You might be trying to get your head around a customer's set up, where the... Continue Reading →
Resource Hog! What’s my busiest database?
Image by Belinda Cave from Pixabay Imagine that we're seeing very heavy load on our SQL server, be it CPU or IO and we need to find out which database is the driver. I'm sure we've all been there at some point, sometimes it's easy to tell. We might only have a handful of databases... Continue Reading →
BlitzBlockingChain, Getting Blocking Chains from sp_BlitzWho
Photo by Joey Kyber on Pexels.com I'm going to assume that most people will have at least heard of Brent Ozar's brilliant First Responder Kit. If you haven't then you've been missing out on some serious (and FREE) SQL troubleshooting goodness and I'd suggest you check it out. Now I use these scripts all the... Continue Reading →
Which Processes are waiting on a Spinlock?
Spinlock contention is always a real headache to deal with. I recently saw an issue when spinlock contention on SOS_CACHESTORE was making the server virtually unresponsive. The issue was very intermittent with no obvious pattern but the assumption is that it was caused by a particular process in the application. Finding what that process was... Continue Reading →
External Temp Tables Preventing Plan Reuse in Stored Procedures
Here's an interesting issue that recently came up. We were seeing very high compilations and recompilations on a server to the point that it started causing us some very serious issues (admittedly this wasn't the sole issue but it was certainly a contributing factor, the other factors were also very interesting so I might look... Continue Reading →
sp_RestoreScript 1.9 – a dirty little bug squished!
It look like we had a little bug in sp_RestoreScript that was putting a rogue 0 after the backup file name. That's now been fixed in 1.9. For information and documentation please visit https://sqlundercover.com/2017/06/29/undercover-toolbox-sp_restorescript-a-painless-way-to-generate-sql-server-database-restore-scripts/ Keep an eye out for sp_RestoreScript 2.0 which is currently in development and will bring a while load of new features... Continue Reading →
My Application is Getting SQL Timeout Errors, But What Query is the Problem?
This is something that comes up time and time again. A developer or member of the service desk comes up to me and says "SQL's timing out, you see what the query is?". Well I'll tell you now that SQL's not timing out your query, SQL will happily run a query for a year and... Continue Reading →
Inspector V2.6 now available
As always the code can be found here in our github repoWe updated our sample report hereWe forgot to mention V2.5! We added the ability to add Thresholds per drive for the drivespace module.#270 #279 - Improved the server settings module, if server changes have been made between collections this module will now pick them... Continue Reading →