“Favorites” or “macros” in SQL Server Management studio?

假装没事ソ 提交于 2019-12-04 03:49:52
Andrei Rantsevich

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.

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.

I haven't read through the whole thing yet, but this article is about creating an add-in for SSMS, which you might be able to do in order to automate what you want.

You could create a shortcut to launch SQL Server Management studio using command line parameters, as follows:

SQLWB.EXE - launches SQL Server Management Studio from the Command Prompt or Start -> Run text box. Through its switches, you can specify which type of server (-t S, -t A, or -t C for SQL Server, Analysis Server, or SQL Server Mobile Edition, respectively), server name (-S), and database (-d) you want to connect to, provide authentication information, or designate which queries, projects, or solutions to open (-i filename). The defaults (in absence of switches) are defined in the Tools -> Options menu of the SQL Server Management Studio.

[Source]

This solution is admittedly a hack, but if you can figure out the exact keystrokes needed to accomplish each 'macro', you can use a free tool like AutoHotKey to automate the keystrokes using whatever shortcuts you wish.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!