SSMS: a list of commonly used queries

Does anyone know if there is an add-in or is there a place where you can save frequently used SQL queries besides keyboard shortcuts? I would like to save a query like this to my Favorites so that I can refer to it when I need it. I would like to change the Where criteria for c.name LIKE '%%' . That is why keyboard shortcuts will not work.

PS: I do not have SA or administrator rights in my database.

 SELECT t.name AS table_name, SCHEMA_NAME(schema_id) AS schema_name, c.name AS column_name FROM sys.tables AS t INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID WHERE c.name LIKE '%%' ORDER BY schema_name, table_name; 
+4
source share
2 answers

You can use the Template Explorer (Ctrl + Alt + T) In the Template Explorer, right-click to create a new template and modify it to enter a query. For each request, you can select it by double-clicking on it.

+5
source

That's right: you need a template explorer, as described above. Addition: you can add your own templates using the following route scheme:

C: \ Users \ WIN_USERNAME \ AppData \ Roaming \ Microsoft \ SQL Server Management Studio \ 11.0 \ Templates \ Sql \ GROUP \ TEMPLATE NAME.sql

If you have very often used scripts and want them to be at your fingertips, you might find this feature useful: http://www.ssmsboost.com/Features/ssms-add-in-autoreplacements SSMSBoost auto-replacements

"AutoCorrect" allows you to define some fragment that will be inserted after entering the marker and press the spacebar / enter / tab. This is inconvenient for the SSMSBoost add-ons for the SSMS that I am developing.

+1
source

Source: https://habr.com/ru/post/1502893/


All Articles