Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSMS: List of frequenly used queries

Does anyone know if there is an add-in or if there is a place where you can save frequently used SQL queries, besides keyboard shortcuts? I would want to save a query like this one to a "Favorites" location so I can reference it when I need it. I would want to change the 'Where' criteria for c.name LIKE '%%'. Which is why keyboard shortcuts wouldn't work.

PS: I don't have SA or admin rights on my DB.

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;
like image 291
Jeremy F. Avatar asked Mar 22 '23 09:03

Jeremy F.


1 Answers

You can use the Template Explorer (keyboard Shortcut is Ctrl + Alt+ T) In Template explorer right-click to create new Template and Edit it to type in your query. For each query, you can select it by double-clicking on it.

like image 187
Frank Goortani Avatar answered Apr 01 '23 17:04

Frank Goortani