Choose to have ALTER instead of CREATE scripts
When I hover over an object and get the pop-up script for that object (proc/view/function) I would like the ability to have the script default to ALTER instead of CREATE.
99.9% of the time I manually have to edit the Create to be an Alter, this would save SO MUCH time.
-
Stuart Davis commented
Yes this is great and I do use object explorer a lot, it retains some of the lost functionality you had by default in the previous Enterprise Manager, eg if I want to rename several objects, I can just get on and use the keyboard to jump alphabetically around the list directly with a single key press and use F2 to rename without having to keep going back to the mouse, selecting each object and then right-clicking to choose rename, back to the keyboard, getting RSI etc ;-)
Doing a bulk operation like a find/replace on several objects is fine if you know in advance which objects you need to select, but the vast majority of the time I don't have a pre-determined list of objects to work with, but instead will be building my script by working through existing procs, which is where the ability to pop open a referenced object's definition on the fly is such a useful feature. Being able to make use of this on the clipboard immediately as an alter script would still be a massive benefit, particularly as most of my work is with two SSMS apps on either monitor, working in one and pasting to the other.
In fact if there was be an option to *append* a script to the clipboard instead of just replacing the content of the clipboard then wow, I could save months, Lol.
-
If you're doing search and replace and want to include multiple objects, one tip would be to use the multi-select ability and script as ALTER ability of the Object Explorer Details pane. I describe this in more detail here: https://www.simple-talk.com/blogs/2012/04/24/ever-wondered-what-the-object-explorer-details-window-is-for/
-
Stuart Davis commented
Hey David, thanks for pointing that out. I did not know about the F12 option!
I would still find it extremely beneficial to have the scripts generated as ALTER by default and also to have the context menu offer an ALTER script to the clipboard too; or perhaps in the pop open script dialog window there could be buttons to copy the script to the clipboard both as either a create or an alter.
I am often in the scenario of building roll-out scripts or doing search-replace type operations on numerous scripted objects together and for this, scripting each object to a new window is not beneficial as I still need to copy to the clipboard and paste the scripts into one window where I am building my roll-out script or collating multiple objects to then do a global search/replace on etc
Thanks, Stuart.
-
Are you aware that you can press F12 when the cursor is on an object? This scripts it to a new window as ALTER. The option is also on the context menu when you right click on an object in a query window.