Snoobie
Snoobie

Reputation: 193

SQL Server: Is it possible to pin a query to the toolbar?

I run a query very often and was wondering if it's possible to pin that query to the menu bar or toolbars of SQL Server for easy access?

Or does anyone have an alternate solution they use?

EDIT: Using Microsoft SQL Server 2012

Upvotes: 1

Views: 4048

Answers (2)

Morpheus
Morpheus

Reputation: 1634

Create a custom template and then you can easily access it from the Template Explorer in SSMS

To create a custom template

  1. In Template Explorer, navigate to the node where you would like to store the new template.
  2. Right-click the node, point to New, and then click Template.
  3. Type the name for your new template and then press ENTER.
  4. Right-click the new template, and then click Edit. In the Connect to Database Engine dialog box, click Connect to open the new template in Query Editor.
  5. Create a script in Query Editor. Insert parameters in your script in the format . The data type and value areas must be present, but can be blank.
  6. On the toolbar, click Save to save your new template.

https://technet.microsoft.com/en-us/library/ms179334(v=sql.105).aspx

Upvotes: 2

Cetin Basoz
Cetin Basoz

Reputation: 23797

If you are not using one of those 3rd party tools, like redgate's SQL Prompt, then:

  • You could save your query as an SQL script,
  • When you launch SSMS,open the .sql file that you saved, connect to the server and select database that you want to run your SQL script on,
  • Now you can keep that tab open in a new horizontal or vertical tab if you wanted to, switch to it anytime you want to run and press F5

It is not pinning to toolbar but well enough IMHO.

Upvotes: 0

Related Questions