Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the same scripts over and over again

Status
Not open for further replies.

bmacbmac

IS-IT--Management
Jan 26, 2006
392
0
0
US
I work with about 75-100 databases. I find myself typing the exact same select statement(s) several times per day in various databases. They are pretty short:

Code:
select * from table1 t1
join table2 t2
on t1.recordid = t2.recordid
join table3 t3
on t2.nameid = t3.nameid

Is there some sort of shortcut anyone knows where I can store these select statements to run on the fly? I can save them all in a notepad and copy/paste, but by the time I do that I might as well have typed it all out in the first place. Just looking for a shortcut for the repetitive statements I run on any of my 75 databases each day.

Thanks!
 
If you're only interested in the results of that exact query without making any tweaks to it, consider assigning it to a Query Shortcut.
Tools > Options > Environment > Keyboard > Query Shortcuts
Copy the query to one of the shortcuts, then just press the Ctrl combination to display the results. You'll need to restart SSMS after assigning the shortcut.
 
bmacbmac,
Do you really have tables named "table1", "table2", "table3" in "about 75-100 databases" [ponder]


---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top