Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Favorites" or "macros" in SQL Server Management studio?

I have a few databases that I always use SQL Server Management Studio with. I'd like to be able to create a toolbar button or keyboard shortcut that automatically opens a new query window (in the current SSMS instance) and connects to a given (registered, perhaps) database. That's it. That's all I need. And this ashtray, and the paddle game, and the remote control. That's all I need.

As it is now, I have to expand the Object Explorer, collapse/expand two to eight trees, right-click on my database, and choose "New Query". I see no way to do it, this would probably save me 30-60 seconds a day.

like image 939
Patrick Szalapski Avatar asked Oct 06 '08 20:10

Patrick Szalapski


People also ask

How do I create a macro in SQL Server?

Macro is a set of SQL statements which are stored and executed by calling the Macro name. The definition of Macros is stored in Data Dictionary. Users only need EXEC privilege to execute the Macro. Users don't need separate privileges on the database objects used inside the Macro.

What is a bookmark in SQL?

A bookmark lookup is the process of finding the actual data in the SQL table, based on an entry found in a non-clustered index.

How do I select multiple lines in SSMS?

To leverage this feature, you need to hold down the ALT key, then left click on your mouse to drag the cursor over the text you want to select and type/paste the text you want to insert into multiple lines.


2 Answers

I am developer of SSMSBoost add-in and it has exactly what you need: is allows to manage the list of preferred servers/databases and quickly switch between them via custom Combobox on the toolbar, you can also say, if you want all servers to be opened in ObjectExplorer upon start-up and if a new query window should be opened for them (per-server setting).

SSMSBoost also allows you to define aliases (instead of server8273128 > MainServer, server231232> BackupServer etc..) It has more features - but they are out of scope of this topic.

Look at the picture - you can see Quick Connection Switch combobox with some Servers from preferred connections, "SSMSBoostDemoServer" - is an alias for the server, next name - is original.

One more thing - add-in is available in free edition.

SSMSBoost toolbar

like image 82
Andrei Rantsevich Avatar answered Sep 30 '22 04:09

Andrei Rantsevich


Have you tried creating a registered server?

Take a look at the "Registered Servers" view (Ctrl-Alt-G). Define a server connection. Set the password, and click the "Remember Password" checkbox if you're not using Windows Authentication. On the "Connection Properties" tab, set your preferred database. Save the server registration.

Now, to connect to that database on that server (assuming you've got the Registered Server pane always visible, as I do), you just need to select that registration node and hit Ctrl-N.

That should save you at least 43 seconds a day.

like image 24
Michael Petrotta Avatar answered Sep 30 '22 04:09

Michael Petrotta