erikdarlingdata / DarlingData

Open source SQL Server nonsense: sp_PressureDetector, sp_QuickieStore, sp_HumanEvents, etc.
https://www.erikdarling.com/
MIT License
443 stars 132 forks source link

Make sp_QuickieStore early exit if the procedure searched for does not exist when using @get_all_databases. #413

Closed ReeceGoding closed 2 months ago

ReeceGoding commented 2 months ago

Closes #412, but not in a way I'm proud of. It will probably be best to write some reusable logic for early exiting. This PR is what I believe to be the smallest change to fix the bug. I'm fairly confident that this doesn't break anything, but I haven't looked very closely at this procedure.

HannahVernon commented 2 months ago

Looks like it should work from my brief review of the database_cursor WHILE loop.

erikdarlingdata commented 2 months ago

@ReeceGoding Sorry for the late reply, I've been traveling a bit. Just so I'm clear, the idea here is to exit the loop early and move to the next database when a stored procedure isn't found in one of the available databases? If so, do you think it would be beneficial to insert a dummy row into one of the existing temp tables to note that, or perhaps print a message to the console?

ReeceGoding commented 2 months ago

@erikdarlingdata Yes. That's completely right.

Of your two options, adding a print makes much more sense to me. If you have a lot of databases, then dummy rows would just provide noise. I'll add the print now, but I don't have a machine handy to test it with at the moment.

ReeceGoding commented 2 months ago

@erikdarlingdata I've added the print in. An almost-perfect one was already just under it, so this was little more than a copy and paste job.