Query Execution History
Had this with SSMS Tools Pack but upon migrating to 2012 I ditched it in favor of SQL Prompt. The only thing I'm missing is a log of my Query History, time-stamped and searchable.
We’re still tracking this suggestion, keen to hear from more of the community about use cases. Do get in contact if this is important to you.
Joffrey Verkade commented
A use case: I run a lot of queries. I don't want to save each one them. There are cases I know I have run something before and I can retrieve it from the history by searching for a keyword. Accidentally closing a query window without saving but you have run the query prior to closing the window. Retrieving previous versions of stored procedures (accidental overwrite) because you had the new and old version still open in query windows.
Something like Devart Execution History is needed
I really vote for this feature, for now I have to use third party tools for this.
I work somewhere where there's unwarned workstation reboots due to patches being installed and infrastructure staff doing miscellaneous configuration changes on workstations. I lock my workstation and go home for the day at the end of each day, instead of a careful archival process of all of the query tabs I have open, and all previous states of these tabs.
I rely on being able to view previously executed queries to return to those queries if I was in the middle of something when I get into work the next morning.
This would be an excellent compliment to the tab history. As others have stated, tab history is great for the _last_ version of a query, but sometimes it would be helpful to go back further than that.
Integrating both histories into a repository that can be stored in the cloud (like OneDrive) would also be great for people that use multiple computers.
Query execution history is huge. The general use case is when you run a query that you expect to run once, and then a day later, or a week later, or 6 months later, it turns out you need to run it again. Common scenarios include ad hoc requests from the business, DBA style diagnostic queries for troubleshooting particular issues, troubleshooting queries you might run for other developers... the list of use cases is huge and honestly should be fairly obvious. Not every query goes into source control.
sql complete have this fitcher hope you are going to be better...
Brandon Peterson commented
I am also super interested in this feature. I see that you have requested feedback from this and have been provided essentially what I will state below, I am surprised with your vast tools set that you didn't already have it.
We have a license for the Red-Gate SQL Toolbelt essentials. I currently use a product that has the capability of this suggestion and I was hoping to replace their tool with SQL prompt or something else, it appears I will have to still use both products.
It enables me be review the sql text executed against which database, time, server, user, status(failed or successful) and how long it took to run. Other options within this grid view enable you to filter out by date range as well as a "quick search" and filter and sort on the columns. I store 6 months history of all scripts I have run through SSMS.
I run different scripts on many databases throughout a day whether it is local to my computer or in Azure. The scripts vary in need; cleaning or fixing bad data, troubleshooting. Or simply seeing if something was actually executed against a database that should have been.
Please consider adding this feature.
Matt MacDonald commented
I'd like to up-vote this as well. I use a competing product that has this feature and this is pretty much the only thing stopping me from switching to SQLPrompt.
I'm really interested in this. I can work on the same query for many hours and often want to get back to something I *executed* earlier. The current implementation only saves the latest version of any script
I have finally given up and purchased SSMS tools about two months ago and installed it along side SQL Prompt. I have literally gone to it at least 25 times to pull old queries. This is such a glaring hole in an otherwise incredible product. I freaking LOVE the way SSMS tools has an option to save the queries to a database. Having every thing I ever executed on any DB is just freaking awesome.
From all feature ideas, this ranks #2, so hopefully this can be part of a very near future release...
Just adding a comment, hoping this feature will make it to the top of your priorities. Although Tab History is great, it doesn't allow you to tell what has actually ran against which connection. Being certain that statement X has been issued garantees a way to reproduce specific operations. As I can see below, we all have this 'I thought it'd be a once off where I put 1 hour of time in, but apparently it's not - weeks later' moment. This feature would be a tremendous time saver.
I was SOOOO hoping to see query execution history in V10.....
Some usage scenarios
- With appropriate options (save to a separate database) it becomes an awesome library of sql I have executed to search when I need to do something.
- Huge time saver when I need to run that one-off query again that wasn't so one-off
- 'Did you run a query that did this?' Let me look. No, here's the query I ran on this date at this
time. *BONUS* Option to save to GIT! That would really rock the house.
- Life saver when I clear a close a tab/crash/whatever and need that query I was testing.
Ok yeah went a little off the rails there. Seriously, I probably wish one a week 'damn I wish sql prompt had execution history'
So just once again to push this to the surface as I've now twice this week lost a set of queries because I accidentally closed the tab (Yeah, I know..idiot). I don't want to have to purchase SSMS Tools Pack to JUST get execution history (and they don't have a license for a single user that can float machines or honestly, at this point, I'd have bought it). PLEASE Red Gate. SQL Prompt needs this BADLY.
For what it's worth, another use case is what I just did. I closed the @#$!@#$@# tab by mistake. Lost six one-off queries. Execution History would have made me think 'I love Sql Prompt' (I do this pretty regularly anyway)
And I want to second Adam Machanic on his use case - this is a big one. I also have to concur with prior posts of this being a gap on SQL Prompt.
Absolutely would love to see this added. Miss it so much from SSMS Toolkit. It had excellent features on this for storing it into a database table as well. Being able to see the history of every command you executed can be a life saver in certain situations. We're part way there with tab history, but honestly, I find it to be sort of useless. Sometimes I get lucky and something is in there I want but most of the time it's not. I'd rather ditch tab history in favor of execution history (or keep both if that works)
Adam Machanic commented
Sorry, a bit late on replying regarding use cases.
I am often asked to do "one-off" analysis or debugging. For example, "what is the deal with this bad-looking data point?" So I'll go in, run a bunch of queries, figure things out, resolve the situation, move on with life. Now, 3 months later, "I think we're hitting that same weird issue again that you resolved 3 months ago. Can you help?" And at this point, I don't recall what I did. I didn't save the scripts I wrote at the time, because it was just a one-off exercise. And this is where the history kicks in. IF I had it enabled, I'd simply search my archives, find my queries, and save myself potentially a few hours of time. My customer is happy, Red Gate has saved the day and proven its value, and I'm elated to have not had to waste my time. Win-win-win for everyone!